3

I'm trying to (re)connect to an existing Cast session from Chrome. I use the (higher level?) Cast Framework and try to follow the CastVideos-chrome example as closely as possible.

Options (which, as far as I understand, should enable joining an existing session):

cast.framework.CastContext.getInstance().setOptions({
  receiverApplicationId: chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,
  autoJoinPolicy: chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED,
  resumeSavedSession: true,
});

This what I call to invoke Chrome's 'Cast destination picker':

function connect() {
  return new Promise.resolve()
  .then( () => {
    const castSession = cast.framework.CastContext.getInstance().getCurrentSession();
    if (!castSession) {
      return cast.framework.CastContext.getInstance().requestSession()
      .then( () => {
        return cast.framework.CastContext.getInstance().getCurrentSession();
      });
    }
    return castSession;
  });
}

Chrome's 'Cast destination panel' panel pops up but I have to stop the existing session on the cast device before I can connect to it. What I want is to (re)connect to the existing session, not stop it then start a new one.

enter image description here

Q: I should be able to join / reconnect to the existing session, but how?

Others have asked this same or similar question before but a) that was years ago and b) the answers mention support has been added at some point and that it should work but don't really say how to do it or link to documentation.

REJH
  • 3,273
  • 5
  • 31
  • 56
  • I've done some more testing. If I start a cast, then open a new tab with the same page that *does* resume the existing session. If I start a cast, then reload the page it does not resume the session. If I start a cast, then open the same page in another Chrome user profile, it does not allow me to join the session. Is this a bug? – REJH Apr 05 '20 at 11:46
  • On https://casttool.appspot.com/cactool/ I was able to start a cast session on one device and connect with a second device using the 'Resume' button and a copy of the Session ID. It doesn't always work (one should see 'Session ID displayed right under 'Receiver App ID' when 'Resume' is clicked, like on the first device), and even if it does, I have to issue play, pause (or any command) on either instance after they both are in the session to have both instances work properly. So it can work, but I feel it should not be required to copy the session ID around to all devices before they join. – Bert Regelink Jul 26 '20 at 17:15

0 Answers0