Audio focus handling with move than one ExoPlayer-instance/video-playing
Version
Media3 1.4.1
More version details
Also tested and seen in v1.1.0
Devices that reproduce the issue
Seen on every device tested on, including:
- Google Pixel 7
- Xiaomi Mi 10T
- Samsung Galaxy S22 Ultra
Devices that do not reproduce the issue
No response
Reproducible in the demo app?
Not tested
Reproduction steps
- Create two ExoPlayer instances
- set: setAudioAttributes(new AudioAttributes.Builder().build(), true) on both instances
- Play videos on both instances
- One video will not be playing
- Background the app and bring to foreground, videos will swap which one is playing and which one is not
NOTE: I generated the bug report after step (4) but before step (5), as I thought step (5) might cloud the logging.
Change the 'handleAudioFocus' parameter passed into 'setAudioAttributes' to false and both videos play correctly, but we lose functionality of playback being paused when a phone call comes into the device (and resumed afterwards).
I have also tried setting the following on 'AudioAttributes.Builder()': .setUsage(C.USAGE_MEDIA) .setContentType(C.AUDIO_CONTENT_TYPE_MOVIE)
Expected result
Both videos play
Actual result
Only one video plays
Media
Any two MP4's - resolution, bitrate, codec are unimportant.
Tested with two h264 low resolution videos.
Bug Report
- [x] You will email the zip file produced by
adb bugreportto [email protected] after filing this issue.
Small update. We have implemented our own audio focus handling at 'manager' level (that knows about all the currently instantiated ExoPlayer objects). So we have a fix for the issue within our product.
Will leave the issue here for you to deem if it is actually an issue, or rather 'as designed system'.
@Ste-RH Can you share about the solution?