This commit is contained in:
Kasper Rynning-Tønnesen
2018-06-04 22:27:02 +02:00
parent 7234867531
commit b0a24d9946
2 changed files with 7 additions and 1 deletions

View File

@@ -79,6 +79,7 @@ module.exports = function() {
}); });
socket.on('chromecast', function(msg) { socket.on('chromecast', function(msg) {
console.log("chromecast event", msg);
try { try {
if(typeof(msg) == "object" && msg.hasOwnProperty("guid") && if(typeof(msg) == "object" && msg.hasOwnProperty("guid") &&
msg.hasOwnProperty("socket_id") && msg.hasOwnProperty("channel") && typeof(msg.guid) == "string" && msg.hasOwnProperty("socket_id") && msg.hasOwnProperty("channel") && typeof(msg.guid) == "string" &&
@@ -99,6 +100,7 @@ module.exports = function() {
coll = coll.substring(0, coll.indexOf("?")); coll = coll.substring(0, coll.indexOf("?"));
} }
in_list = true; in_list = true;
console.log("chromecast list", coll);
chromecast_object = true; chromecast_object = true;
socket.join(coll); socket.join(coll);
} }
@@ -110,6 +112,7 @@ module.exports = function() {
}); });
socket.on("get_id", function() { socket.on("get_id", function() {
console.log("gotten request from mobile", Functions.getSession(socket));
socket.emit("id_chromecast", Functions.getSession(socket)); socket.emit("id_chromecast", Functions.getSession(socket));
}); });

View File

@@ -296,7 +296,7 @@ initializeCastApi = function() {
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, thumbnail: Player.np.thumbnail}) 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, thumbnail: Player.np.thumbnail})
castSession.sendMessage("urn:x-cast:zoff.me", {type: "nextVideo", videoId: full_playlist[0].id, title: full_playlist[0].title, source: full_playlist[0].source, thumbnail: full_playlist[0].thumbnail}) castSession.sendMessage("urn:x-cast:zoff.me", {type: "nextVideo", videoId: full_playlist[0].id, title: full_playlist[0].title, source: full_playlist[0].source, thumbnail: full_playlist[0].thumbnail})
if(Helper.mobilecheck() && !chromecast_specs_sent) { if(Helper.mobilecheck()) {
socket.emit("get_id"); socket.emit("get_id");
} }
hide_native(1); hide_native(1);
@@ -322,6 +322,9 @@ initializeCastApi = function() {
} catch(event){ } catch(event){
_seekTo = seekTo; _seekTo = seekTo;
} }
if(Helper.mobilecheck()) {
socket.emit("get_id");
}
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, thumbnail: Player.np.thumbnail}) 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, thumbnail: Player.np.thumbnail})
castSession.sendMessage("urn:x-cast:zoff.me", {type: "nextVideo", videoId: full_playlist[0].id, title: full_playlist[0].title, source: full_playlist[0].source, thumbnail: full_playlist[0].thumbnail}) castSession.sendMessage("urn:x-cast:zoff.me", {type: "nextVideo", videoId: full_playlist[0].id, title: full_playlist[0].title, source: full_playlist[0].source, thumbnail: full_playlist[0].thumbnail})
hide_native(1); hide_native(1);