I was able to update media session on sender after receiver loads next media in the following way. For instance, in an episodic content, switching from one episode to another.
On Sender:
var session = window.cast.framework.CastContext.getInstance().getCurrentSession();
...
session.loadMedia(loadRequest).then(function() {
...
// this is a media session of the first episodic content
mediaSession = session.getMediaSession(); // returns instance of chrome.cast.media.Media
mediaSession.addUpdateListener(function(isAlive) {
// invoked when the status of the media has changed
// [update next media session here]
});
...
}, function() {
//errorHandler
});
On Receiver
var mediaManager = new cast.receiver.MediaManager(video);
...
// the first episode is loaded from sender to receiver
...
// after the first episode is complete, loads second episode
mediaManager.load(loadRequestData); // loadRequestData contains media request data and its metadata
On Sender:
Add the following where it says [update next media session here] above.
var nextMediaSession = session.getSessionObj().media; //returns instance of chrome.cast.media.Media which is the updated media session of the second episode