This commit is contained in:
Kasper Rynning-Tønnesen
2018-02-27 15:23:57 +01:00
parent d24c542f2a
commit 183f2ae5b9
2 changed files with 14 additions and 13 deletions

View File

@@ -113,19 +113,6 @@ function chromecastListener(evt, data) {
console.log("error parsing again");
}
console.log(json_parsed.type, typeof(json_parsed));
if(json_parsed.type == 1) {
console.log("it is 1");
if(!$("#play").hasClass("hide")) {
$("#play").addClass("hide");
}
$("#pause").removeClass("hide");
} else if(json_parsed.type == 2) {
console.log("it is 1");
if(!$("#pause").hasClass("hide")) {
$("#pause").addClass("hide");
}
$("#play").removeClass("hide");
}
//console.log(JSON.parse(json_parsed), json_parsed.type, json_parsed.type == 1, json_parsed.type == "1");
switch(json_parsed.type){
case -1:

View File

@@ -238,6 +238,20 @@ initializeCastApi = function() {
switch (event.sessionState) {
case cast.framework.SessionState.SESSION_STARTED:
castSession = cast.framework.CastContext.getInstance().getCurrentSession();
var customData = [
{type: "nextVideo", videoId: full_playlist[0].id, title: full_playlist[0].title},
{type: "loadVideo", start: Player.np.start, end: Player.np.end, videoId: video_id, seekTo: _seekTo, channel: chan.toLowerCase()},
];
if(Helper.mobilecheck()) {
customData.push({type: "mobilespecs", guid: guid, socketid: socket.id, adminpass: adminpass == "" ? "" : Crypt.crypt_pass(adminpass), channel: chan.toLowerCase(), userpass: embed ? '' : Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()))});
}
var request = new chrome.cast.media.LoadRequest({
media: {
contentId: video_id,
contentType: 'video/*',
},
customData: customData,
});
castSession.addMessageListener("urn:x-cast:zoff.me", chromecastListener)
chrome.cast.media.GenericMediaMetadata({metadataType: 0, title:song_title, image: 'https://img.youtube.com/vi/'+video_id+'/mqdefault.jpg', images: ['https://img.youtube.com/vi/'+video_id+'/mqdefault.jpg']});
//chrome.cast.Image('https://img.youtube.com/vi/'+video_id+'/mqdefault.jpg');