AudioAttributes FLAG_AUDIBILITY_ENFORCED and Volume

Viewed 1350

quick question as it seems I might have missed something.

I have a media player class with which I want to play a mp3.

I set the attributes thus...

 AudioAttributes aa = new AudioAttributes.Builder()
                    .setUsage(AudioAttributes.USAGE_MEDIA)
                    .setContentType(AudioAttributes.CONTENT_TYPE_MUSIC)
                    .setFlags(FLAG_AUDIBILITY_ENFORCED)
                    .build(
 mediaplayer.setAudioAttributes(aa);

However, when the track plays it uses the System (Ringer) volume as the master volume control. Not the media volume as I would expect. If I miss out setting the flag...

.setFlags(FLAG_AUDIBILITY_ENFORCED)

It works as expected and uses the media volume. Why does setting the flag above change which volume on the device controls the playback?

Thank you!

0 Answers
Related