In my app, I am using the CastCompanionLibrary to cast videos to a chromecast device. I want to perform some action when the video has finished playing. How do I determine as to when the video has completed playing? I did not find any suitable callback for this.
onRemoteMediaPlayerStatusUpdated()
. This will inform you when the playback status changes.mediaStatus = mCastManager.getMediaStatus()
; this will give you the updated status.mediaStatus == MediaStatus.PLAYER_STATE_IDLE
and mCastManager.getIdleReason() == MediaStatus.IDLE_REASON_FINISHED
, then it means the currently playing item is just finished.Note that a version of this is already being done in the associated fragment so please tell us what you are doing exactly; what I suggested allows you to generically find out when the playback of a single media items reaches its end.