0
votes

According to

https://developers.google.com/cast/docs/design_checklist#sender-control-end

Sender stops cast

Content which is cast to a TV continues playing until either the last 
connected sender disconnects, or until a sender casts something new.

Required
A   When the last or only sender is connected to a receiver, tapping
    Disconnect stops the app running on the receiver, and either 
    continues playing or pauses on the sender device. 

I am using the castcompanionlibrary from Google.

If I do

mgr.setStopOnDisconnect(false);

it will not stop the receiver app when the last sender disconnects. If I set it to true it stops the receiver app even if it is not the only connected sender app.

What do I need to do in the sender app so that it stops the receiver app only when the last sender disconnects? That is, when the user wants to disconnect, I need to check if I am the last/only sender app currently connected and if so, first stop the receiver app and then disconnecting.

1

1 Answers

1
votes

That is not done in the sender; senders generally don't know how many other connected senders are out there, nor they need to know. The receiver, however, has that information and is the one who should stop the app if needed. The correct behavior/code is documented here; look for the subsection "Session Management". Note that the Default/Styled receivers already do that.