mirror of https://github.com/calzoneman/sync.git
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 PLAYER = false;
|
||||
var MEDIATYPE = "yt";
|
||||
var PLAYER = new Media();
|
||||
var MEDIATYPE = "null";
|
||||
var POSITION = -1;
|
||||
var RANK = 0;
|
||||
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
|
||||
var tag = document.createElement("script");
|
||||
tag.src = "http://www.youtube.com/iframe_api";
|
||||
var firstScriptTag = document.getElementsByTagName("script")[0];
|
||||
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
|
||||
if(!USEROPTS.hidevid) {
|
||||
var tag = document.createElement("script");
|
||||
tag.src = "http://www.youtube.com/iframe_api";
|
||||
var firstScriptTag = document.getElementsByTagName("script")[0];
|
||||
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
|
||||
}
|
||||
|
||||
var sendVideoUpdate = function() { }
|
||||
setInterval(function() {
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
var Media = function(data) {
|
||||
if(!data) {
|
||||
data = {
|
||||
id: "",
|
||||
type: "null"
|
||||
};
|
||||
}
|
||||
this.id = data.id;
|
||||
this.type = data.type;
|
||||
this.diff = 0;
|
||||
|
@ -29,10 +35,20 @@ var Media = function(data) {
|
|||
this.initJWPlayer();
|
||||
break;
|
||||
default:
|
||||
this.nullPlayer();
|
||||
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() {
|
||||
this.removeOld();
|
||||
this.player = new YT.Player("ytapiplayer", {
|
||||
|
@ -397,6 +413,9 @@ Media.prototype.removeOld = function() {
|
|||
}
|
||||
|
||||
Media.prototype.hide = function() {
|
||||
if(this.type == "null") {
|
||||
return;
|
||||
}
|
||||
this.getTime(function(seconds) {
|
||||
this.time = seconds;
|
||||
this.hidden = $("#ytapiplayer").detach();
|
||||
|
@ -404,6 +423,9 @@ Media.prototype.hide = function() {
|
|||
}
|
||||
|
||||
Media.prototype.unhide = function() {
|
||||
if(this.type == "null") {
|
||||
return;
|
||||
}
|
||||
this.hidden.appendTo($("#videodiv"));
|
||||
var data = {
|
||||
id: this.id,
|
||||
|
|
Loading…
Reference in New Issue