Trigger Media Play/Pause or Seek
Closed this issue · 1 comments
Fabii23 commented
I have a couple questions
- How would I go about triggering "mediaPlay" , "mediaPause" or "mediaSeek" ?
- How do I load cast starting at a specific time
1.)
I tried adding the snippet below to chrome.cast.js :
chrome.cast.Session.prototype.pause = function (successCallback, errorCallback) {
if (chrome.cast.isAvailable === false) {
errorCallback(new chrome.cast.Error(chrome.cast.ErrorCode.API_NOT_INITIALIZED), 'The API is not initialized.', {});
return;
}
execute('mediaPlay', function (err) {
if (!err) {
successCallback && successCallback();
} else {
handleError(err, errorCallback);
}
});
};
and call is via :
castSession.pause(
function successCallback(){
log('Pause Cast content');
},
function errorCallback(){
log('Failed to pause content');
});
This does not seem to work, any ideas ?
2.)
I tried modifying LoadRequest to take a _currentTime parameter
LoadRequest: function (media, _currentTime) {
this.type = 'LOAD';
this.sessionId = this.requestId = this.customData = null;
this.media = media;
this.autoplay = !0;
if(_currentTime){
this.currentTime = _currentTime;
}
}
Fabii23 commented
Nevermind, silly mistake on my part, I had to copies of the source file and was editing the wrong file. The above prototype extensions work.