I recently updated my application from the old CastCompanionLibrary to Chromecast SDK3 and although play and seek work normally, I can't resume playback after pause. I am logging the error as follows
player.play().setResultCallback(new ResultCallbacks<RemoteMediaClient.MediaChannelResult>() {
@Override
public void onSuccess(@NonNull RemoteMediaClient.MediaChannelResult mediaChannelResult) {
Log.d("cast", "SUCCESS");
}
@Override
public void onFailure(@NonNull Status status) {
Log.d("cast", "FAILURE "+status.getStatusMessage());
}
});
The failure reason is always 2100 FAILED, the in progress request failed
.
I also updated the receiver application to use the default Styled Media Receiver but it doesn't seem to make any difference.
SOLUTION
The problem was that I was calling
remoteClient.load(myMediaInfo, true, position);
remoteClient.play();
It turns out that if you load the MediaInfo with autoplay=true
, you are not allowed to directly call play()
. If you do, the video starts playing and can be paused and seeked but can never be resumed. Play always fails with the error above. I think the framework could handle this a bit better or at least give a decent error message, which can lead to some kind of conclusion, which is not the case with 2100 FAILED.