Skip to content

Make AudioBecomingNoisyManager, WakeLockManager, and AudioFocusManager public #1893

Closed

Description

@johngray1965

[REQUIRED] Use case description

When implementing a player that is not based on exoplayer, we need to handle becoming noisy, audio focus, and the wake management ourselves. Exoplayer has implementations for all these that I believe I could use in my player, but they are package private.

Proposed solution

Make AudioBecomingNoisyManager, WakeLockManager, and AudioFocusManager public. Or make a variant of SimpleBasePlayer that handles them.

Alternatives considered

my current solution is to copy these classes.

Activity

  1. self-assigned this
    on Nov 21, 2024
  2. icbaker commented on Nov 21, 2024

    @icbaker
    Collaborator

    Make AudioBecomingNoisyManager, WakeLockManager, and AudioFocusManager public

    I assume that since you want to use these with a non-ExoPlayer player you'd want them in an artifact like androidx.media3:media3-common, rather than media3-exoplayer.

    I will discuss this proposal with the team.

  3. johngray1965 commented on Nov 21, 2024

    @johngray1965
    ContributorAuthor

    Yes, in the app I'm working I use exoplayer for audiobooks, and TTS Voices for reading text for non-audio books. So I use a custom player for TTS Voices.

  4. kuro-mujou commented on Feb 21, 2025

    @kuro-mujou

    @johngray1965 sir, do you have any idea for the custom player for TTS?

  5. johngray1965 commented on Feb 21, 2025

    @johngray1965
    ContributorAuthor

    For the Custom player for playing the TTS Voices, I made copies of AudioBecomingNoisyManager, WakeLockManager, and AudioFocusManager for my custom player. But there's kind of maintenance nightmare.

  6. kuro-mujou commented on Feb 21, 2025

    @kuro-mujou

    @johngray1965 could i have a look at your player class? i currently want to implement the simple base player and somehow i have an issue with media button receiver. i want to know what did i do wrong with my player...

  7. johngray1965 commented on Feb 21, 2025

    @johngray1965
    ContributorAuthor

    Sorry, the app I'm working on is closed source. So I can't share the code. I can tell you bit about it. I ended just having a single player (otherwise it caused issues when I moved from one document to another if they needed a different player). So I created one derived from SimpleBasePlayer. I have two ItemPlayers (one that use exoplayer, and one that uses TTS voices). The common player does all common things (managing playlists, etc...). The ItemPlayers just know how to play a single item and general play control things for a single item (play, plause, jump forward, jump back, etc..). And they report their position back to the real player. If you want to share you code, I'll tell you if I see what's wrong.

  8. tonihei commented on Oct 13, 2025

    @tonihei
    Collaborator

    These classes are now public (will be released with version 1.9.0)

  9. locked and limited conversation to collaborators on Dec 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions