4

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 Answers 2

1

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

3
  • I have gone the route of having the receiver tell the sender which media to load. It just seems like an unnecessary additional step. Commented Mar 11, 2014 at 12:08
  • @MarcFallows I believe I'm running into the same problem. Are you saying you had the receiver send a message to the sender, and then had the sender call load()?
    – masterwok
    Commented Jun 12, 2017 at 2:42
  • 2
    @masterwok That used to be the case, but it is now possible for the receiver to load media without the involvement of a sender: developers.google.com/cast/docs/reference/receiver/… Commented Jun 13, 2017 at 3:58
0

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.

3
  • So all media has to be loaded by a sender? That seems like a major limitation. Isn't there a way to load media from the receiver that a sender gets updates on? Wouldn't that be the same mechanism as a sender getting updates from media loaded by a different sender? Commented Mar 6, 2014 at 16:40
  • You can have the receiver load a media or do anything else that you want in your custom receiver but then the MediaManager is bypassed and you need to do the work of informing/updating connected senders in your own receiver. MediaManager is built to receiver media control messages from senders and handle those and provide feedback to senders when appropriate; if you want to have a different flow, you need to build something that fits your own use case.
    – Ali Naddaf
    Commented Mar 6, 2014 at 17:27
  • Sorry if the questions seem repetitive, but can you confirm that there is no way to take advantage of the MediaManager in the receiver and getting a hold of the media session in the sender if loading the media from the receiver? I am looking for something like chrome.cast.Session.loadMedia() but initated from the receiver. Commented Mar 7, 2014 at 9:16

Not the answer you're looking for? Browse other questions tagged or ask your own question.