Search code examples
chromecastgoogle-cast

Stop casting on the receiver


I need to disconnect from the sender and return to receiver's main ("ready to cast" screen). Receiver decides when and how to do that (e.g. 10 mins idling after media playback was paused)

I've tried to stop receiver explicitly

receiver.stop()

and disconnecting the connection service

cs = receiver.getConnectionService()
cs.disconnect()

That didn't work as I wanted, it doesn't return to the main screen and all senders still see it as an ongoing cast session

enter image description here

So how can I force disconnecting on the receiver? Receiver API page seems to be describing only these two methods.


Solution

  • You shouldn't call receiver.stop(), nor calling cs.disconnect(); instead try using window.close().