google / ExoPlayer

This project is deprecated and stale. The latest ExoPlayer code is available in https://github.com/androidx/media
https://developer.android.com/media/media3/exoplayer
Apache License 2.0
21.72k stars 6.03k forks source link

Support custom AudioManager flags when changing device volume #10028

Open wingkingbobo opened 2 years ago

wingkingbobo commented 2 years ago

I have my own volume control bar. I hope to call exoplayer Do not display the UI of the system when using the exoPlayer.setDeviceVolume() method. The comments in the source code mention that it will let users decide whether to display the system UI. Will this function be provided, or is there any other way to set the system volume.

com.google.android.exoplayer2.StreamVolumeManager

 // TODO(b/153317944): Allow users to override these flags.
  private static final int VOLUME_FLAGS = AudioManager.FLAG_SHOW_UI;
ojw28 commented 2 years ago

Will this function be provided

I will mark this as a (low priority) feature request.

Is there any other way to set the system volume.

I don't think there's anything preventing you from calling AudioManager directly to adjust the volume, rather than calling ExoPlayer.setDeviceVolume(). In other words, I think you should be able to do what StreamVolumeManager does directly in your own application code, at which point you can specify whatever flags you like.