I get session_error LOAD_CANCELLED
when trying to send a 2nd video to the chromecast receiver.
I'm trying to implement a custom receiver to cast videos from my website. At this point the application works fine, with all messages being exchanged as expected, except that if I have a video casting, I am not able to load a second video onto the receiver, because of the above error.
According to the documentation, this is expected behaviour (https://developers.google.com/cast/docs/reference/receiver/cast.receiver.media.ErrorType#.LOAD_CANCELLED).
static cast.receiver.media.ErrorType.LOAD_CANCELLED
Returned when the LOAD request is cancelled by a second incoming LOAD request
However I checked a number of other simpler applications and they all to exactly the same thing when playing a 2nd video: call Load one more time from the sender, and it works as expected.
This is my onLoad
overwritten:
/* Start onLoad event processing */
Receiver.prototype.mediaOnLoadEvent_ = function(event) {
console.debug('Receiver.js: mediaOnLoadEvent_()');
var playListener = function(e) {
document.removeEventListener('video-READY', playListener);
// BUILDING MEDIAINFO and METADATA HERE
// .....
// .....
console.debug('Receiver.js: sending load complete');
this.mediaManager_.setMediaInformation(mediaInformation, true, {});
this.mediaManager_['mediaOrigOnLoad'](event);
}.bind(this);
document.addEventListener('video-READY', playListener);
window.CustomPlayer.loadVideo(event.data.media.contentId,
event.data.currentTime, function({});
};
this is the messages I get in the console for the receiver when I send the 2nd LOAD request:
[ 86.580s] [cast.receiver.IpcChannel] Received message: {"data":"{\"type\":\"LOAD\",\"requestId\":54589218,\"sessionId\":\"1B476387-AE78-4F07-BD06-A8CFEF4509A0\",\"media\":{\"contentId\":\"2365405980\",\"streamType\":\"BUFFERED\",\"contentType\":\"\"},\"autoplay\":true,\"currentTime\":0}","namespace":"urn:x-cast:com.google.cast.media","senderId":"243:client-50611"} cast_receiver.js:13
[ 86.585s] [cast.receiver.CastMessageBus] Dispatching CastMessageBus message cast_receiver.js:13
[ 86.591s] [cast.receiver.MediaManager] MediaManager message received cast_receiver.js:13
[ 86.595s] [cast.receiver.MediaManager] Dispatching MediaManager load event cast_receiver.js:13
[ 86.602s] [cast.receiver.MediaManager] Sending error message to 243:client-50611 cast_receiver.js:13
[ 86.606s] [cast.receiver.IpcChannel] IPC message sent: {"namespace":"urn:x-cast:com.google.cast.media","senderId":"243:client-50611","data":"{\"requestId\":54589182,\"type\":\"LOAD_CANCELLED\"}"} receiver.js?v=0.2:117
Receiver.js: mediaOnLoadEvent_()
As you can see, my mediaOnLoadEvent
is being called after the load_cancelled
event was sent, so there's nothing I can do with it.
Thanks.