-
Notifications
You must be signed in to change notification settings - Fork 460
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
How can I remove player commands of the platform mediasession? #542
Comments
How about: media/libraries/session/src/main/java/androidx/media3/session/MediaSession.java Lines 670 to 673 in 5328d64
|
Ideally, the case you described should be handled in this method. @marcbaechinger Am I right in assuming that this is the problem you are currently addressing by moving the channeling the legacy controller through our internal Media3 controller? If so, we can use this issue to track this enhancement (or duplicate it if there already is one). @darrentaft: As a workaround, you can wrap you player in a |
I'm not super-familiar with PiP, but I assume that Picture-in-Picture is connected to the platform session. But yes, using a
The mentioned approach would then also handle this for the notification for which I assume, the controls should be hidden for live in the same way. I'll mark this issue as an enhancement to track the change we are talking about. |
That's great, thanks - I can confirm that ForwardingPlayer removes the play/pause button (although bizarrely it only disables the skip back/forward buttons, rather than removing them). That's good enough for now though. |
I think the button being disabled only may be the problem we have for Auto as well and is described in #339 |
@darrentaft @marcbaechinger I attempted to achieve custom controls in Picture-in-Picture (PiP) mode using Media3Session, but it only allows disabling the "Next" and "Previous" controls rather than fully hiding them. To work around this, I tried implementing a forwarding player, but the issue persisted. I also explored overriding the controls via onConnect() and setCustomLayout() to display a custom layout with "Play/Pause" and "10-second forward/backward" buttons. However, the default "Play/Pause," "Next," and "Previous" controls continue to appear. While it’s possible to disable "Next" and "Previous," there doesn’t seem to be a way to hide them entirely. It seems the current implementation doesn’t fully support replacing the default controls in PiP mode. Could this limitation be addressed, or is there an alternative approach to completely customize the PiP controls? using mediaSession? |
Thanks for your comment.
Can you let us know how you did this with the legacy |
On sample provided by google of mediaSessionCompat was also not able to hide only disabled and also not able to show other controls like increment/decrement ones instead of next and previous In both cases play/pause is able to hide but not next and previous This checked with PiP |
We offer live DASH streams within our app. We're using our own custom player controls, so have full control over what the user can do - i.e. when it's on-demand content we allow them to seek/pause/skip/etc, but when it's live they can only stop the stream.
With the standard integration of Media3 into MediaSession, we're finding that the Picture-In-Picture window is automatically offering player controls. This is great for on-demand content, but for our live streams we don't want the user being able to pause or seek the stream (as there's only a 44 second seekable window).
I can see a "setAvailableCommands" option on the MediaSession, however I can't work out where to get the additional "controller" and "sessionCommands" parameters from. I tried using the listener onConnect() approach, but it had no effect.
Google hasn't helped me find any suitable answers - either for Media3, or for ExoPlayer.
The text was updated successfully, but these errors were encountered: