Open Belhaver1993 opened 3 months ago
Hello, is there any development on this question? :)
I think the session gets the available commands via the Player.Listener.onAvailableCommandsChanged()
.
So for that to work with a ForwardingPlayer
in the current version, you'd have to intercept the listener calls that add and remove listeners and register you own listener to the upstream player. Then when your listener is called you'd delegate to the registered listeners.
It would be an option to make this easier when MediaSessionImpl
would use playerWrapper.getAvailableCommands()
on that callsite instead of the arguments passed in by the listener. For now you would need to go the route with listener interception I think.
Correctly changing the available commands using ForwardingPlayer
is described here: https://developer.android.com/media/media3/exoplayer/customization#intercepting-method
We're aware this is fiddly and error-prone, and we have an internal issue (b/323900817) to experiment with adding a ForwardingSimpleBasePlayer
which we hope will help make it easier to consistently modify the behaviour (or available commands) of a delegate/inner Player
instance.
I have a similar issue to the one described here.
Based on the data I have in
MediaMetadata
I want to have control whetherCOMMAND_SEEK_TO_NEXT
is available or not.To reproduce issue from demo application, I altered data in
catalog.json
fromdemos/session_service
and changedartist
for few media items to empty strings inElectronic
category. Then I wrappedExoPlayer
withForwardingPlayer
inDemoPlaybackService
When I run the code,
ExoPlayer
inPlayerActivity
displays thatexo_next
button is always available, even though when I click this button it sets some strange state in the player (no progress, old media item still plays).But, when I add exactly the same code to the
PlayerActivity
exo_next
button displays state correctly.With this info I have few questions:
MediaController
respect what's insideForwardingPlayer
to be correctly shown in theplayerView.player
?seekToNext
? This one is strange, because in my application overriding those methods in our implementation ofPlayer
interface is enough to control the behaviour of media notification.ExoPlayer
in only one place (service) to get it work correctly?