google / google/ExoPlayer

Error ignored when using CastPlayer. No callbacks

Open
#8,364 3 comments 2 reactions 1 assignee Claimed by @AquilesCanta View on GitHub
bug
Dominant language
Java
Stars
21.9k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Hi I have a problem with CastPlayer. It's not Android/Device specific as this is a problem I have with implementation.

I have a bunch of links representing each of chapters in my Audiobook that I download at the startup of my audiobook player. Everything works fine at the start and I can easily listen to audiobook on Chromecast (with the help of CastPlayer and entire MediaSession family). The problem starts when my links get expired (they expire after 2h). On normal player (SimpleExoPlayer) I get an error visible in Player.EventListener.onPlayerError(). It's a HttpDataSource.HttpDataSourceException that I can easily parse and react on it by downloading fresh batch of links.
However CastPlayer is not using this callback. It's not using any callback in fact when facing this error. I noticed that on line 422 in CastPlayer there is a callback (code below) which in my case gets a MediaChannelResult with error result code of 2100. However CastPlayer does nothing with this result and does not propagate this error to my code. Is it possible you could add such a callback? It would help me a lot.

```
this.playWhenReady.pendingResultCallback =
new ResultCallback() {
@Override
public void onResult(MediaChannelResult mediaChannelResult) {
if (remoteMediaClient != null) {
updatePlayerStateAndNotifyIfChanged(this);
flushNotifications();
}
}
};
```

I also noticed that `getPlaybackError` and `getPlayerError` methods always return null in CastPlayer. Is it possible to change that too?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.