-
Notifications
You must be signed in to change notification settings - Fork 416
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
When setMediaItems
is called playerCommandsFromPlayer
does not include commands included via getAvailableCommands
of ForwardingPlayer
#1021
Comments
This was a misunderstanding on my part. |
Actually, there still is no call when I add these methods to the ForwardingPlayer implementation override fun getAvailableCommands(): Player.Commands {
return super.getAvailableCommands().buildUpon().add(COMMAND_SEEK_TO_NEXT_MEDIA_ITEM).build()
}
override fun isCommandAvailable(command: Int): Boolean {
return super.isCommandAvailable(command) || command == COMMAND_SEEK_TO_NEXT_MEDIA_ITEM
} I even intercepted in the @OptIn(UnstableApi::class) override fun onAvailableCommandsChanged(availableCommands: Player.Commands) {
super.onAvailableCommandsChanged(
availableCommands.buildUpon().add(COMMAND_SEEK_TO_NEXT_MEDIA_ITEM).build()
)
} The @Override
public void seekToNextMediaItem() {
if (!isPlayerCommandAvailable(Player.COMMAND_SEEK_TO_NEXT_MEDIA_ITEM)) {
return;
} |
The |
I put breakpoints on the 4 writes of |
Ok, so it looks like Looks like setting up the public ExoPlayer build() {
checkState(!buildCalled);
buildCalled = true;
return new ExoPlayerImpl(/* builder= */ this, /* wrappingPlayer= */ null);
} |
setMediaItems
does not get commands included by getAvailableCommands
of ForwardingPlayer
setMediaItems
does not get commands included by getAvailableCommands
of ForwardingPlayer
setMediaItems
is called playerCommandsFromPlayer
does not include commands included via getAvailableCommands
of ForwardingPlayer
Is there some way to force an update of the flags after |
Can you explain a bit more what you'd like to achieve? If it's just about changing the available commands for media controllers, the recommended way is to configure that in |
I was trying to get Setting the @OptIn(UnstableApi::class)
override fun onConnect(
session: MediaSession,
controller: MediaSession.ControllerInfo
): MediaSession.ConnectionResult {
val playerCommands =
session.player.availableCommands.buildUpon()
.add(COMMAND_SEEK_TO_NEXT_MEDIA_ITEM)
.build()
return MediaSession.ConnectionResult.AcceptedResultBuilder(session)
.setAvailablePlayerCommands(playerCommands)
.build()
} I then thought instead that I could add a next media item to the playlist, and of course, since ExoPlayer sees a next media item, it makes the command available. This works, but it seems as though the commands made available through the |
I tested this out and I think there may be some confusion around |
That makes sense, but the seek to next command is still overwritten by ExoPlayer when setMediaItem is called. |
This may be related to you override the listener. If all listener calls get intercepted, then the you always overwrite whatever commands ExoPlayer makes available. |
It is the other way around. ExoPlayer is overwriting the commands I tried to make available via the listener. |
If you feel something is broken, please provide a more complete example that allows us to reproduce the issue. Otherwise I think there must be some missing piece in your forwarding player somewhere. |
Version
Media3 1.2.1
More version details
No response
Devices that reproduce the issue
Samsung Galaxy A12 SM-A125U
Devices that do not reproduce the issue
No response
Reproducible in the demo app?
Not tested
Reproduction steps
Create a
ForwardingPlayer
like soCreate a
MediaLibrarySession
like soCreate a
MediaBrowser
like so:Then call
MediaBrowser.seekToNextMediaItem()
and notice that
ForwardingPlayer.seekToNextMediaItem()
is not called.Expected result
For the
ForwardingPlayer
to get theseekToNextMediaItem()
call.Actual result
The
seekToNextMediaItem()
method of theForwardingPlayer
is not called.Media
Not applicable
Bug Report
adb bugreport
to android-media-github@google.com after filing this issue.The text was updated successfully, but these errors were encountered: