androidx / androidx/media

AudioSink: Add support for multiple listener or provide an AudioSink.Listener wrapper

Open
#1,728 0 comments 0 reactions 1 assignee View on GitHub

@tianyif is already working on this.

Since Sep 13, 2024.

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

Description

[REQUIRED] Use case description

In order to be able to do some things at audiosink level to access the audioTrack to be able to use VolumeShaper I create an ForwardingAudioSink and want to listen to events about audiotrack init / release.

While the need is specific the issue is global. Since audio sink only support a single setListener we can't register the listener easily in the sink as ExoPlayer register itself later in the decoders and replace our listener.

We can of couse write a wrapper for the listener and dispatch manually, but since that interface have many default implementations, if Google add new callback with a default implementation, we can miss this and so the event won't be dispatched correctly.

Proposed solution
  1. Add the usual addListener/removeListener to be able to allow multiple listeners.
  2. Add a ForwardingListener in Media3 to ensure that any new event are properly forwarded and not missed if clients does this manually.
Alternatives considered

Manually create the event forwarder but this is error prone as soon as Google add new events with a default implementation.

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.