diff --git a/www/assets/js/callbacks.js b/www/assets/js/callbacks.js index b65a9b16..2c2201b5 100644 --- a/www/assets/js/callbacks.js +++ b/www/assets/js/callbacks.js @@ -622,6 +622,12 @@ Callbacks = { if(data.type != "sc" && PLAYER.type == "sc") // [](/goddamnitmango) fixSoundcloudShit(); + if(data.type != "jw" && PLAYER.type == "jw") { + // Is it so hard to not mess up my DOM? + var wtf = $("
").attr("id", "ytapiplayer") + .insertBefore($("#ytapiplayer_wrapper")); + $("#ytapiplayer_wrapper").remove(); + } if(data.type != PLAYER.type) { PLAYER = new Media(data); } diff --git a/www/assets/js/client.js b/www/assets/js/client.js index 0a7cd087..d44cc27c 100644 --- a/www/assets/js/client.js +++ b/www/assets/js/client.js @@ -157,6 +157,12 @@ function queueEnd() { if(id) { $("#mediaurl").val(""); } + if(type == "jw") { + makeAlert("JWPlayer", + "If you are queueing a file (not a livestream) with JWPlayer, please note it will only synchronize if you assign a leader.", + "alert-warning") + .insertAfter($("#playlist_controls")); + } socket.emit("queue", { id: id, pos: "end", @@ -173,7 +179,7 @@ $("#mediaurl").keydown(function(ev) { $("#queue_next").click(function() { var urls = $("#mediaurl").val().split(","); - for(var i = 0; i < urls.length; i++) { + for(var i = urls.length - 1; i >= 0; i--) { if(!urls[i].trim()) continue; var parsed = parseVideoURL(urls[i].trim()); @@ -182,6 +188,12 @@ $("#queue_next").click(function() { if(id) { $("#mediaurl").val(""); } + if(type == "jw") { + makeAlert("JWPlayer", + "If you are queueing a file (not a livestream) with JWPlayer, please note it will only synchronize if you assign a leader.", + "alert-warning") + .insertAfter($("#playlist_controls")); + } socket.emit("queue", { id: id, pos: "next", diff --git a/www/assets/js/media.js b/www/assets/js/media.js index 97df9c04..1783ccf0 100644 --- a/www/assets/js/media.js +++ b/www/assets/js/media.js @@ -381,6 +381,12 @@ Media.prototype.initRTMP = function() { } Media.prototype.initJWPlayer = function() { + if(typeof jwplayer == "undefined") { + setTimeout(function() { + this.initJWPlayer(); + }.bind(this), 100); + return; + } this.removeOld(); jwplayer("ytapiplayer").setup({ @@ -400,15 +406,6 @@ Media.prototype.initJWPlayer = function() { socket.emit("playNext"); }); - function removeLogo() { - if($("#ytapiplayer_logo").length > 0) { - $("#ytapiplayer_logo").remove(); - } - else { - setTimeout(removeLogo, 100); - } - } - this.load = function(data) { this.id = data.id; this.initJWPlayer();