I have a VideoView without any audio playing every time I start my app. I have noticed that when it starts playing, music playing from other apps in the background pauses. Is there any solution to this? Thank you!
Playing video while background music playing is not recommended:
To ensure a great user experience, it’s also important that your app manages the audio focus to ensure multiple apps aren’t playing audio at the same time.
You can check this for more information.
When you start play video using VideoView
, you app request the audio focus, this mean the background app which is playing music lose the audio focus. The background app's behavior depends on the code in AudioManager.OnAudioFocusChangeListener.OnAudioFocusChangeListener
method. You can not change it.
More information, see Managing Audio Focus.
VideoView
get the audio focus (check this). Can you post the code about yourVideoView
? – L. Swifter Aug 12 '16 at 1:51videoView.start()
in theonResume()
, the background playing will not pause, I think. – L. Swifter Aug 12 '16 at 2:05start
method when you want to start playing video. Does the background playing works properly when you removestart
inonResume
? If so , I will post an answer. – L. Swifter Aug 12 '16 at 2:29