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.
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.