Is there an onFinished listener of some sort? Or do we have to compare the current stream position against the duration of the track?
Cast Your Entire Android ScreenMake Sure your mobile phone or tablet is on the same Wi-Fi network as your Chromecast device. Open the Google Home app (The Rainbow app that looks like a house). Tap the device you want to cast your screen to. Tap 'Cast my screen' icon (It looks like a box with a Wi-Fi symbol).
Make sure your mobile device or tablet is connected to the same Wi-Fi network or linked to the same account as your speaker or display. Open a Chromecast-enabled app. Tap the Cast icon .
Mirror your Android phone or tablet screen to the TVFrom your Android phone or tablet, open the Google Home app. Tap the left hand navigation to open the menu. Tap Cast screen / audio and select your TV.
It's not pretty but you can make this call:
if (mRemoteMediaPlayer.getMediaStatus().getPlayerState() == MediaStatus.PLAYER_STATE_IDLE
&& mRemoteMediaPlayer.getMediaStatus().getIdleReason() == MediaStatus.IDLE_REASON_FINISHED) {
...
}
Prem, There is currently no callback to register for such event. One alternative (and-not-so-pretty) approach is the following: on the receiver, listen for "ended" event of the media element and send an event back to the sender through a private channel. Another approach is what you suggested: check position against duration. When SDK graduates to general availability, better and cleaner approaches will be available to accomplish what you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With