androidx / media

Jetpack Media3 support libraries for media use cases, including ExoPlayer, an extensible media player for Android
https://developer.android.com/media/media3
Apache License 2.0
1.62k stars 384 forks source link

setMediaItem does not return a Future #97

Open Digipom opened 2 years ago

Digipom commented 2 years ago

While integrating media3 into a wear app, I ran into some issues with setMediaItem silently failing until I figured out that I can't just send a URI from the controller.

I see the internal code actually routes the error back to the controller via a Future; that Future is just dropped in MediaControllerImplBase instead of being returned up the call stack, and no errors are logged.

As a feature request, setMediaItem and other calls that could fail should return that info to the caller instead of silently dropping it.

See also:

https://github.com/androidx/media/issues/93 https://github.com/androidx/media/issues/43 https://github.com/androidx/media/issues/8

nhcodes commented 1 year ago

Hello,

I have a similar issue. I'm using the androidx.media3:media3-cast:1.0.0 CastPlayer and as far as I can see there is no way of handling playback errors. Unfortunately onPlayerError in the Player.Listener interface does not get called. The method setMediaItemsInternal in CastPlayer ignores the ResultCallback returned by remoteMediaClient.queueLoad which usually can be used to check for errors. Is there some other way to listen for playback errors that I don't know of? In my opinion that is a very important feature..

Thank you!