Open XuQK opened 2 years ago
Thanks for reporting!
The onMediaItemTransition
callback should definitely only be called once for a new item. However, I think the eventual fix will not look like your "expected result", but more like:
mediaItem
that is not converted by MediaLibrarySession.Callback.onAddMediaItems().onTimelineChanged(...)
or onMediaMetadataChanged(...)
callback notifying the change in the mediaItem informationThe reason is that the media item transition (from nothing to the initial item) happens immediately at the point where you call mediaController.setMediaItems
.
I thought "the media item transition" should happens after MediaLibrarySession.Callback.onAddMediaItems(). Now I understand. thanks for your explanation.
Media3 Version
1.0.0-beta01
Devices that reproduce the issue
Samsung galaxy note 10 5G running Android 11
Devices that do not reproduce the issue
No response
Reproducible in the demo app?
Not tested
Reproduction steps
In service LibrarySessionCallback.onAddMediaItems() method like this, just transfer uri to
MediaItem
:Initialize controller in
Activity.onStart()
, setMediaItem
list in controller future`s listener:when code B is call automaticaly or by hand, a problem occured.
when
controller.setMediaItems(mediaItems)
called, thecode A
will be call immediately, the given mediaItem paremeter not converted byonAddMediaItems
callback, themonAddMediaItems
has been called, and thencode A
be called again, the mediaItem is converted byonAddMediaItems
.Expected result
When
controller.setMediaItems(mediaItems)
(code B) has been called , the method call order that I except is:MediaLibrarySession.Callback.onAddMediaItems()
onMediaItemTransition(mediaItem, reason)
has been set bycontroller.addListener()
, and given mediaItem is converted byMediaLibrarySession.Callback.onAddMediaItems()
.Actual result
onMediaItemTransition(mediaItem, reason)
has been set bycontroller.addListener()
, and given mediaItem is not converted byMediaLibrarySession.Callback.onAddMediaItems()
.MediaLibrarySession.Callback.onAddMediaItems()
onMediaItemTransition(mediaItem, reason)
has been set bycontroller.addListener()
, and given mediaItem is converted byMediaLibrarySession.Callback.onAddMediaItems()
now.PS: when I set a Listener to ExoPlayer instance in service, it's
onMediaItemTransition()
method has called as I expected. So different behaviors exist betweenMediaController
andExoPlayer
This is the log I print manually, after
controller.setMediaItems(mediaItems)
called, may be useful.Media
Not applicable
Bug Report
adb bugreport
to dev.exoplayer@gmail.com after filing this issue.