7

I'm using a simple receiver based on the Google CastHelloText sample app. When the sender disconnects, I'd like to allow the receiver to continue display.

I thought this could be accomplished by modifying the receiver's onSenderDisconnect function to skip the window.close call but when I disconnect my sender by calling session.stop, the receiver is shutdown withou a call to onSenderDisconnect. I see a "Dispatching shutdown event" in the receiver log.

How can I get the receiver to continue without the sender connection?

SeattleStephens
  • 587
  • 8
  • 20

1 Answers1

6

If you want to allow receiver to continue, do not call stop in your sender; that call sends a message to the receiver that would result in stoping the application on receiver; here is what the documentation for that method says: "Stops the running receiver application associated with the session.". On chrome senders, you can simply close the tab if you want to let the receiver continue . Note that the onSenderDisconnect now has an argument that shows whether disconnect was explicit (intentional) or not, in case you want to handle explicit disconnects differently. Other platforms, e.g. Android SDK, also have similar stopApplication methods that should not be called if you do not want to stop the running application on the receiver. On Android and iOS, you have more APIs to provide a more fine-tuned "disconnect" experience.

Ali Naddaf
  • 16,951
  • 2
  • 21
  • 28
  • 1
    Thanks for the quick response. I see that in the documentation for stop and when I close the chrome tab the receiver continues as I you indicated. How can I disconnect the sender from the receiver without calling stop and without closing the tab? I want the sender app to connect to device 1, cast, leave receiver running and connect to device 2, cast, leave receiver running.... After closing the tab, I open a new tab and connect to my sender app. However, my sender app doesn't see my other chromecast devices? The other chrome tabs do see all of the chromecasts. – SeattleStephens Jun 22 '14 at 03:33