Merge pull request #426 from zoff-music/fix/embedded-next

Fix/embedded next
This commit is contained in:
Kasper Rynning-Tønnesen
2018-09-29 13:05:12 +02:00
committed by GitHub
2 changed files with 12 additions and 4 deletions

View File

@@ -19,7 +19,7 @@ var sc_initialized = false;
var startTime = 0;
var small = false;
var small_player = false;
var full_playlist;
var full_playlist = [];
var hostMode = false;
var soundcloud_enabled = true;
var socket_connected = false;
@@ -83,8 +83,12 @@ function receiveMessage(event) {
} else if(event.data == "get_info") {
window.parentWindow.postMessage({type: "np", title: song_title}, window.parentOrigin);
window.parentWindow.postMessage({type: "controller", id: Hostcontroller.old_id}, window.parentOrigin);
if(full_playlist.length > 0) {
Player.sendNext({title: full_playlist[0].title, videoId: full_playlist[0].id});
try {
if(full_playlist.length > 0) {
Player.sendNext({title: full_playlist[0].title, videoId: full_playlist[0].id});
}
} catch(e) {
}
}
}

View File

@@ -27,7 +27,11 @@ var Player = {
song_title = obj.np[0].title;
duration = obj.np[0].duration;
if(offline && (video_id == "" || video_id == undefined || local_new_channel) && !client){
if(embed) {
try {
window.parentWindow.postMessage({type: "np", title: song_title}, window.parentOrigin);
} catch(e) {}
} else if(offline && (video_id == "" || video_id == undefined || local_new_channel) && !client){
if(obj.conf != undefined) {
conf = obj.conf[0];
}