Skip to content
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

[Feature Request] Close track player and remove from notifications #2415

Open
watadarkstar opened this issue Dec 3, 2024 · 4 comments
Open

Comments

@watadarkstar
Copy link

watadarkstar commented Dec 3, 2024

Context
Since clearNowPlayingMetadata is being removed. This feature has been removed, so I'm adding this as a feature request again.

What is the need and use case of this feature?
When a user is playing a content through other means (e.g. a ultra low latency stream using aws's react-native player) it's misleading to show media controls in the notification center.

Edit: reset is not clearing the notification metadata and thats why we needed it in our app. However, if reset can be fixed that would be fine too.

Describe the ideal solution
Having a clear method to close and remove track player from notification center, which would then open again if "setup" is called. Better still would be if I could pass an argument during it's initial setup so that it'd automatically close if nothing is being streamed/played.

@lovegaoshi
Copy link
Contributor

i felt this is a niche use - the notification panel is meant to resume playback, and if playback resumption is no longer needed, the app/service should be terminated. my gut feeling is this creates instability if users are releasing/recreating MediaSession or MediaLibraryService.

Alternatively we can post a custom notification and clear it accordingly. its quite simple to implement, as the current repo implements it this way. though this implementation will be plagued by various ServiceStartNotAllowed exceptions reported in the issue tracker

@watadarkstar
Copy link
Author

watadarkstar commented Dec 3, 2024

i felt this is a niche use - the notification panel is meant to resume playback, and if playback resumption is no longer needed, the app/service should be terminated. my gut feeling is this creates instability if users are releasing/recreating MediaSession or MediaLibraryService.

Alternatively we can post a custom notification and clear it accordingly. its quite simple to implement, as the current repo implements it this way. though this implementation will be plagued by various ServiceStartNotAllowed exceptions reported in the issue tracker

For us the use case was that we wanted to call reset() but it did not clear the notification metadata which felt weird because nothing was playing. Yet it was showing in the notification tray.

However, if reset can be fixed that would be fine too.

@lovegaoshi
Copy link
Contributor

lovegaoshi commented Dec 3, 2024 via email

@lovegaoshi
Copy link
Contributor

i actually came across TP.reset() in android and at least my fork or this PR clears the notification. so it will be working for android in the distant future.

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

No branches or pull requests

2 participants