4
votes

I have a receiver which sets the src on a videoElement directly (ie. I'm not setting it from the sender chrome.cast.Session.loadMedia() method).

The videoElement has been passed to the chromecast media manager:

mediaManager = new cast.receiver.MediaManager(videoElement);

When I connect a sender (or a sender is already connected), I want to get media status updates. For now I am using the Chrome API for sending.

Unfortunately, when the video loads and begins playback on the receiver it logs the message:

[cast.receiver.MediaManager] Not sending status as there is no on going LOAD request.

How do I tap into a media session from a sender without initiating a load event?

It may be worth mentioning that the session.media[] always appears to be empty and if I setup:

session.addMediaListener(sessionMediaListener);

The sessionMediaListener() is never called

2

2 Answers

1
votes

Today there is no way to initiate a media session from the receiver side. The LOAD command is what triggers the session creation so you will need to ask the sender to send a LOAD command immediately after it has launched the receiver.

Note that you can override the behavior of the LOAD command to do whatever you want (like set the src element yourself...) but the session creation is internal to the MediaManager class.

As per the status updates on a second/third sender, they will receive media status updates as long as they join the application session (no need to relaunch/reload).

I will be interested on the reason it is a problem for you to trigger LOAD from the sender side (if any).

0
votes

You are practically bypassing all the inner workings of the MediaManager; MediaManager practically doesn't know anything about the media that you are playing so it cannot provide you with the information that you want.