androidx / androidx/media

Audio focus handling with more than one ExoPlayer-instance/video-playing

Open
#1,798 2 comments 0 reactions 1 assignee View on GitHub

@tianyif is already working on this.

Since Oct 14, 2024.

bug
Dominant language
Java
Stars
3k
Forks
955
Avg merge
12d 14h
Merged PRs (30d)
2

Description

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
  1. Create two ExoPlayer instances
  2. set: setAudioAttributes(new AudioAttributes.Builder().build(), true) on both instances
  3. Play videos on both instances
  4. One video will not be playing
  5. 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
  • You will email the zip file produced by adb bugreport to android-media-github@google.com after filing this issue.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.