Fix errors when video is hidden
This commit is contained in:
parent
d0b3f9014a
commit
69550c7a51
|
|
@ -10,8 +10,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var LEADER = false;
|
var LEADER = false;
|
||||||
var PLAYER = false;
|
var PLAYER = new Media();
|
||||||
var MEDIATYPE = "yt";
|
var MEDIATYPE = "null";
|
||||||
var POSITION = -1;
|
var POSITION = -1;
|
||||||
var RANK = 0;
|
var RANK = 0;
|
||||||
var OPENQUEUE = false;
|
var OPENQUEUE = false;
|
||||||
|
|
@ -138,28 +138,14 @@ else {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//socket.on("connect", function() {
|
|
||||||
// socket.emit("joinChannel", {
|
|
||||||
// name: CHANNEL
|
|
||||||
// });
|
|
||||||
// if(uname && session) {
|
|
||||||
// socket.emit("login", {
|
|
||||||
// name: uname,
|
|
||||||
// session: session
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// $("<div/>").addClass("server-msg-reconnect")
|
|
||||||
// .text("Connected")
|
|
||||||
// .appendTo($("#messagebuffer"));
|
|
||||||
// $("#messagebuffer").scrollTop($("#messagebuffer").prop("scrollHeight"));
|
|
||||||
//});
|
|
||||||
|
|
||||||
|
|
||||||
// Load the youtube iframe API
|
// Load the youtube iframe API
|
||||||
var tag = document.createElement("script");
|
if(!USEROPTS.hidevid) {
|
||||||
tag.src = "http://www.youtube.com/iframe_api";
|
var tag = document.createElement("script");
|
||||||
var firstScriptTag = document.getElementsByTagName("script")[0];
|
tag.src = "http://www.youtube.com/iframe_api";
|
||||||
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
|
var firstScriptTag = document.getElementsByTagName("script")[0];
|
||||||
|
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
|
||||||
|
}
|
||||||
|
|
||||||
var sendVideoUpdate = function() { }
|
var sendVideoUpdate = function() { }
|
||||||
setInterval(function() {
|
setInterval(function() {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,10 @@
|
||||||
var Media = function(data) {
|
var Media = function(data) {
|
||||||
|
if(!data) {
|
||||||
|
data = {
|
||||||
|
id: "",
|
||||||
|
type: "null"
|
||||||
|
};
|
||||||
|
}
|
||||||
this.id = data.id;
|
this.id = data.id;
|
||||||
this.type = data.type;
|
this.type = data.type;
|
||||||
this.diff = 0;
|
this.diff = 0;
|
||||||
|
|
@ -29,10 +35,20 @@ var Media = function(data) {
|
||||||
this.initJWPlayer();
|
this.initJWPlayer();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
this.nullPlayer();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Media.prototype.nullPlayer = function() {
|
||||||
|
this.player = null;
|
||||||
|
this.load = function(data) { }
|
||||||
|
this.play = function() { }
|
||||||
|
this.pause = function() { }
|
||||||
|
this.getTime = function(callback) { }
|
||||||
|
this.seek = function(time) { }
|
||||||
|
}
|
||||||
|
|
||||||
Media.prototype.initYouTube = function() {
|
Media.prototype.initYouTube = function() {
|
||||||
this.removeOld();
|
this.removeOld();
|
||||||
this.player = new YT.Player("ytapiplayer", {
|
this.player = new YT.Player("ytapiplayer", {
|
||||||
|
|
@ -397,6 +413,9 @@ Media.prototype.removeOld = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Media.prototype.hide = function() {
|
Media.prototype.hide = function() {
|
||||||
|
if(this.type == "null") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.getTime(function(seconds) {
|
this.getTime(function(seconds) {
|
||||||
this.time = seconds;
|
this.time = seconds;
|
||||||
this.hidden = $("#ytapiplayer").detach();
|
this.hidden = $("#ytapiplayer").detach();
|
||||||
|
|
@ -404,6 +423,9 @@ Media.prototype.hide = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Media.prototype.unhide = function() {
|
Media.prototype.unhide = function() {
|
||||||
|
if(this.type == "null") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.hidden.appendTo($("#videodiv"));
|
this.hidden.appendTo($("#videodiv"));
|
||||||
var data = {
|
var data = {
|
||||||
id: this.id,
|
id: this.id,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue