Skip to content

Add notification for empty player setting #2670

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nift4
Copy link
Contributor

@nift4 nift4 commented Jul 27, 2025

No description provided.

@tonihei
Copy link
Collaborator

tonihei commented Jul 30, 2025

Thanks for the idea. How would a notification for the empty player look like? It seems to me that basically all relevant and required information is missing at this point unless there is a custom MediaNotification.Provider?

@nift4
Copy link
Contributor Author

nift4 commented Jul 30, 2025

How would a notification for the empty player look like? It seems to me that basically all relevant and required information is missing at this point unless there is a custom MediaNotification.Provider?

In its most basic form, it looks like this:
grafik
Notably, the title "Gramophone is running" is supplied by the system because the app doesn't send any. On older versions, it'd display empty text instead.

Indeed, rather useless/irrelevant on its own.

The reason I am interested in it at the moment is stupid hacks, see #770 (comment). But that is not the only reason I want this.

On my not-too-far-future roadmap, there's an item about more support for session-based cast protocols (it's not what I'm actually working with, but you can think of Miracast as example). Etablishing a connection takes considerable effort (confirmation on both devices) and time, hence it was decided a user should generally manually terminate a session (for example, by pressing the custom close command button in the media notification) instead of the app ending the session when there is no media currently set for whatever reason. To remind the user there still is casting session going on, there needs to be some sort of notification. Making the media notification disappear when playlist is empty just to show a casting session notification which isn't MediaStyle, which then disappears again and having a media notification come up when playlist stops being empty, is poor UX. Instead, the media notification should just signify that it is empty. This will be done with a ForwardingSimpleBasePlayer that modifies getMediaMetadata() to show a relevant message. (A custom MediaNotification.Provider is not necessary in this case.) For example:

    override fun getState(): State {
        if (player.currentTimeline.isEmpty) {
            val superState = super.state
            return superState.buildUpon().setPlaylist(superState.timeline, superState.currentTracks,
                MediaMetadata.Builder().setTitle("Nothing here...").build()).build()
        }
        return super.getState()
    }

The play button can also be added/removed as needed by changing available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants