Tmarsh2
Tmarsh2

Reputation: 427

Playing Webm in Videoview without gaining audio focus

I currently have an app which plays numerous animated gifs in .webm format. However, as I have this in a videoview, it gains audio focus, therefore other apps playing audio will stop.

Is there any work around to prevent this?

Thanks!

Upvotes: 3

Views: 1005

Answers (1)

Ana Llera
Ana Llera

Reputation: 1916

The only way that I found (personally, I do not recommend it) is copy VideoView class from Android sources and comment out these lines:

AudioManager am = (AudioManager)getContext().getSystemService(Context.AUDIO_SERVICE);
am.requestAudioFocus(null, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN);

Finally I opted for ruxy solution but probably will not be an option in your case

Upvotes: 1

Related Questions