Activity is destroying after trying to start Media player - android

Need some help who has experience with media player. On Nexus 7 device after pressing home button(pausing media player), when returning to player from recent list, activity is destroying as soon as start of media player method is called. In other devices seems working good. Any suggestions?
Thanks in advance,

Related

Youtube controls (play/pause) don't work after player is restored/activity is resumed

I have an activity with a YouTubePlayerSupportFragment within it to play youtube videos.
The youtube player's style is set to CHROMELESS (only video, no controls), and playback is controlled by my own custom play/pause button outside of the player's view. Every thing works as expected until the moment I leave the video activity for whatever reason and then come back to it.
Upon leaving the activity the video is paused - as expected - but after returning to it, requesting the player to player.play() does nothing. No errors nor exceptions, it just does nothing. Play() will only work again after I load a new video..
I've trying using YouTubePlayerFragment instead, but the result is the same. However, when using the DEFAULT style pressing the default play button will apparently reload the video (I see the buffer being flushed) from the previous position and work as expected. This leads me to believe that they're handling it somehow directly on their UI control code instead of on the player API..
I can reproduce this issue on the SDK's custom controls sample just by starting a video, pressing the recents key and returning to it so I think it's safe to assume that this is a bug..
Has anyone been able to work around this issue? is there any way to detect that the video needs to be reloaded while this isn't fixed?
Info: I'm using youtube's android player API v1.2.2 and the latest youtube app v10.49.59
After hours, the only solution I found was to save video position on Pause event and reload video (player.loadVideo) on PostResume event (when YouTubeFragment is resumed). But I don't known if this is the only/best solution.

Music stops playing on certain devices and keeps playing on others

Hi everyone I recently made an application that is actually a media player of a football club ultras music. I tested it on my phone (Motorola X running Android 4.4.4) when i go back to the dashboard the music keeps playing and everything is OK. But I had a review that on Samsung Trend Plus running Android 4.2.2 the music stops playing when going back to dashboard. I didn't know what may cause this issue? any ideas? Thanx
Most likely your problem is with audio focus. On certain system, when user go to the dashboard, the launcher might take audio focus (and pause your audio play) to play its launch sound (the clicking noise or w/e). Right after that, it should hand back audio focus to you and you will need to resume your playing.
http://developer.android.com/training/managing-audio/audio-focus.html

Android MediaPlayer stops on backpressed

I'm developing a radio stream app.I use android - mediaplayer class which plays radiostream. I m trying to run app in two devices . When I pressed back button in Samsung galaxy S3 mini(4.2.2) radio stream continues to playing. And I controls media player with notification bar. But when I pressed back button in Samsung galaxy S3(4.3) mediaplayer stopping to play. Why is stopping media player? How can I prevent stop when pressed back?
I don't use service but still I have not understood why s3 kills activity. But I found a solution . I change my super.onBackPressed() to moveTaskToBack(true);. And I added this option to manifest file in activity tag(Main) android:noHistory="true". Anymore when I pressed back key MediaPlayer isn't stopping stream. Maybe this solution may be useful to someone else. And I thanks for all of you for the answers.
Without some code i doubt anyone will be able to help.
How are you playing the radio stream? Are you using a service? If not the back button on S3 could be killing your app thus terminating the stream.

Android media player stops when open gallery

I developed a simple music player using MediaPlayer class. I played a song using it, minimize my music player, then I open native gallery, and my application get weird.
It becomes like stuck for a few seconds, and then it started to play new song.
I also did like that using android native player and the player paused when gallery opened.
Do you guys know what might cause my application stucked like that?
I really appreciate any help from you guys,
Regards,
Chrisma Andhika
see in your app, if you minimize your app it goes to onpause() state again come return to app it will call onresume() state. so it takes some time. there is nothing weird in this thing.

Android 3.2 VideoView freezes, audio carries on

I'm streaming HLS, and after 10 minutes or so, the video hangs but the audio stays on. I can then not click anything other than holding the home button to get the task manager to force close the app. Anyone know how to fix this?

Categories

Resources