Sending source of video to chromecast

This commit is contained in:
Kasper Rynning-Tønnesen
2018-05-04 17:21:18 +02:00
parent d40c2503cd
commit bebf397687
2 changed files with 9 additions and 9 deletions

View File

@@ -199,7 +199,7 @@ window.addEventListener("DOMContentLoaded", function() {
tag.onload = function() {
console.log("loaded script")
if(document.querySelectorAll("script[src='https://w.soundcloud.com/player/api.js']").length == 1) {
} else {
tagSearch = document.createElement('script');
tagSearch.setAttribute("async", true);
@@ -296,8 +296,8 @@ initializeCastApi = function() {
} catch(event){
_seekTo = seekTo;
}
castSession.sendMessage("urn:x-cast:zoff.me", {type: "loadVideo", start: Player.np.start, end: Player.np.end, videoId: video_id, seekTo: _seekTo, channel: chan.toLowerCase()})
castSession.sendMessage("urn:x-cast:zoff.me", {type: "nextVideo", videoId: full_playlist[0].id, title: full_playlist[0].title})
castSession.sendMessage("urn:x-cast:zoff.me", {type: "loadVideo", start: Player.np.start, end: Player.np.end, videoId: video_id, seekTo: _seekTo, channel: chan.toLowerCase(), source: videoSource})
castSession.sendMessage("urn:x-cast:zoff.me", {type: "nextVideo", videoId: full_playlist[0].id, title: full_playlist[0].title, source: full_playlist[0].source})
if(Helper.mobilecheck() && !chromecast_specs_sent) {
socket.emit("get_id");
@@ -325,8 +325,8 @@ initializeCastApi = function() {
} catch(event){
_seekTo = seekTo;
}
castSession.sendMessage("urn:x-cast:zoff.me", {type: "loadVideo", start: Player.np.start, end: Player.np.end, videoId: video_id, seekTo: _seekTo, channel: chan.toLowerCase()})
castSession.sendMessage("urn:x-cast:zoff.me", {type: "nextVideo", videoId: full_playlist[0].id, title: full_playlist[0].title})
castSession.sendMessage("urn:x-cast:zoff.me", {type: "loadVideo", start: Player.np.start, end: Player.np.end, videoId: video_id, seekTo: _seekTo, channel: chan.toLowerCase(), source: videoSource})
castSession.sendMessage("urn:x-cast:zoff.me", {type: "nextVideo", videoId: full_playlist[0].id, title: full_playlist[0].title, source: full_playlist[0].source})
hide_native(1);
Helper.css("#channel-load", "display", "none");
Helper.addClass('.castButton', 'castButton-white-active');

View File

@@ -382,7 +382,7 @@ var Player = {
if(end) e = end;
else e = Player.np.end;
if(chromecastAvailable){
castSession.sendMessage("urn:x-cast:zoff.me", {start: s, end: e, type: "loadVideo", videoId: id, channel: chan.toLowerCase()});
castSession.sendMessage("urn:x-cast:zoff.me", {start: s, end: e, type: "loadVideo", videoId: id, channel: chan.toLowerCase(), source: videoSource});
chrome.cast.media.GenericMediaMetadata({metadataType: 0, title:song_title, image: 'https://img.youtube.com/vi/'+id+'/mqdefault.jpg', images: ['https://img.youtube.com/vi/'+id+'/mqdefault.jpg']});
chrome.cast.Image('https://img.youtube.com/vi/'+id+'/mqdefault.jpg');
} else {
@@ -498,7 +498,7 @@ var Player = {
Player.getTitle(song_title, viewers);
//Player.setBGimage(video_id);
if(chromecastAvailable){
castSession.sendMessage("urn:x-cast:zoff.me", {type: "loadVideo", videoId: video_id, channel: chan.toLowerCase(), start: start, end:end});
castSession.sendMessage("urn:x-cast:zoff.me", {type: "loadVideo", videoId: video_id, channel: chan.toLowerCase(), start: start, end:end, source: videoSource});
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');
} else {
@@ -535,7 +535,7 @@ var Player = {
//Player.setBGimage(video_id);
if(chromecastAvailable){
castSession.sendMessage("urn:x-cast:zoff.me", {type: "loadVideo", videoId: video_id, channel: chan.toLowerCase(), start: start, end: end});
castSession.sendMessage("urn:x-cast:zoff.me", {type: "loadVideo", videoId: video_id, channel: chan.toLowerCase(), start: start, end: end, source: videoSource});
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');
} else {
@@ -547,7 +547,7 @@ var Player = {
sendNext: function(obj){
if(chromecastAvailable){
castSession.sendMessage("urn:x-cast:zoff.me", {type: "nextVideo", title: obj.title, videoId: obj.videoId});
castSession.sendMessage("urn:x-cast:zoff.me", {type: "nextVideo", title: obj.title, videoId: obj.videoId, source: obj.source});
}
if(embed) {