Glimesh / glimesh_app

The official Glimesh Mobile App.
https://glimesh.tv/about/app
MIT License
10 stars 5 forks source link

Audio buttons adjust phone volume instead of media volume #54

Open clone1018 opened 2 years ago

clone1018 commented 2 years ago

We've got the audio coming out of the media output device successfully, but it appears we're still registering some type of phone volume because by default adjusting the android audio changes the phone volume instead of media.

By default, pressing the volume control modifies the volume of the active audio stream. If your app isn't currently playing anything, hitting the volume keys adjusts the music volume (or the ringer volume before Android 9). From: https://developer.android.com/guide/topics/media-apps/volume-and-earphones#java

clone1018 commented 2 years ago

I suspect the real issue is that somewhere deep in the Flutter WebRTC library we're still treating this like a call. Honestly since we don't even need half the features the library provides we may want to consider slimming it down a bit.

I tried some crazy combinations of code, based on Googling. The recommended solution was something like:

Activity activity = getActivity();
activity.setVolumeControlStream(AudioAttributes.USAGE_MEDIA);

Which did not work, so that leads me to believe something is overwriting that.