-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Add methods for replacing playlist items in Player #8046
Comments
Yes, that's a very reasonable request. Thanks for filing! |
Out of interest, why is getting multiple playlist change notifications a problem for your case? I think we discussed |
With the new media2 extension each player timeline change notification triggers notifications for media session's playlist changes which involve posting on a |
@tonihei , how can the |
Replacing the media item would mean replacing the underlying Do I understand correctly that you actually would rather want to only update the |
Well, not explicitly, but I am also interested how this can be achieved with the current API. The reason for the request is to be able run any player playlist updates though a diffing library and apply a list of minimal changes so that bigger playlists can be updated in a efficient manner. The obvious choice is Not that the setup doesn't work with the current APIs, I'm just worried about the unnecesary playback state updates and notifications done on each step and searching for ways to reduce them. I'm even considering of adding a feature request for methods for controlling these notifications or the ability to do batches of changes and report them as a single change. |
Ok, thanks for clarification. If you are going to replace items in the queue in that sense 'blindly' by just running the recorded changes of another object graph, you can probably not know in advance whether this will remove or replace the playing media item which would led to a interruption of playback. This will be the case with a replaceMediaItems(...) method as well, when the range of replaced items contains the playing item. I suggest we leave this issue being an |
I have the same need to update the playlist. |
I have the same need. |
I'm not sure I understand what is the difference of the code above and this line
The above line seems to do the same, but with less code. Is there a difference in behaviour with your approach? |
Lol, yeah, it works the same way. Thanks! |
This methods allows to replace single items or a range of items directly without using separate operations for add and remove. The advantage is more readable code for apps and the potential for player implementations to optimize this process (e.g. only replace values without interrupting playback). The current change just introduces the API with its default behavior. The default logic will be removed again in the future in favor of better logic in the Player implementations. Issue: google/ExoPlayer#8046 PiperOrigin-RevId: 532151471
This methods allows to replace single items or a range of items directly without using separate operations for add and remove. The advantage is more readable code for apps and the potential for player implementations to optimize this process (e.g. only replace values without interrupting playback). The current change just introduces the API with its default behavior. The default logic will be removed again in the future in favor of better logic in the Player implementations. Issue: #8046 PiperOrigin-RevId: 532151471
This change moves the default logic into the actual Player implementations, but does not introduce any behavior changes compared to addMediaItems+removeMediaItems except to make the updates "atomic" in ExoPlayerImpl, SimpleBasePlayer and MediaController. It also provides backwards compatbility for cases where Players don't support the operation. Issue: google/ExoPlayer#8046 #minor-release PiperOrigin-RevId: 534945089
This change moves the default logic into the actual Player implementations, but does not introduce any behavior changes compared to addMediaItems+removeMediaItems except to make the updates "atomic" in ExoPlayerImpl, SimpleBasePlayer and MediaController. It also provides backwards compatbility for cases where Players don't support the operation. Issue: #8046 #minor-release PiperOrigin-RevId: 534945089
This methods allows to replace single items or a range of items directly without using separate operations for add and remove. The advantage is more readable code for apps and the potential for player implementations to optimize this process (e.g. only replace values without interrupting playback). The current change just introduces the API with its default behavior. The default logic will be removed again in the future in favor of better logic in the Player implementations. Issue: google/ExoPlayer#8046 PiperOrigin-RevId: 532151471 (cherry picked from commit b1cfeb0)
This change moves the default logic into the actual Player implementations, but does not introduce any behavior changes compared to addMediaItems+removeMediaItems except to make the updates "atomic" in ExoPlayerImpl, SimpleBasePlayer and MediaController. It also provides backwards compatbility for cases where Players don't support the operation. Issue: google/ExoPlayer#8046 #minor-release PiperOrigin-RevId: 534945089 (cherry picked from commit 2c07468)
This methods allows to replace single items or a range of items directly without using separate operations for add and remove. The advantage is more readable code for apps and the potential for player implementations to optimize this process (e.g. only replace values without interrupting playback). The current change just introduces the API with its default behavior. The default logic will be removed again in the future in favor of better logic in the Player implementations. Issue: #8046 PiperOrigin-RevId: 532151471 (cherry picked from commit 7289186)
This change moves the default logic into the actual Player implementations, but does not introduce any behavior changes compared to addMediaItems+removeMediaItems except to make the updates "atomic" in ExoPlayerImpl, SimpleBasePlayer and MediaController. It also provides backwards compatbility for cases where Players don't support the operation. Issue: #8046 #minor-release PiperOrigin-RevId: 534945089 (cherry picked from commit 6309b11)
This comment was marked as spam.
This comment was marked as spam.
شكرا جزيلا |
[REQUIRED] Use case description
In Exoplayer v2.12.0 the new playlist/MediaItem API is missing methods for replacing an existing item(s) at a given position.
The feature is needed if someone needs to refresh the metadata/clipping data/duration/... of an item already in the playlist. In my case I am using a diffing library to update the playlist via a change script which results in add/remove/change/move calls. Yes, one can always do a remove/add, but calling
Player.addMediaItems()
thenPlayer.removeMediaItems()
results in multiple playlist change notifications. I was a bit amazed that there's even a bulk move method (Player.moveMediaItems()
), but nothing for changing an existing item.Proposed solution
Add
Player.replaceItem(int, MediaItem)
andPlayer.replaceItems(Int, List<MediaItem>)
methods or something similar.The text was updated successfully, but these errors were encountered: