Leader synchronization for JWPlayer

This commit is contained in:
calzoneman 2013-06-02 19:19:51 -04:00
parent ecabb5e71b
commit 3ebf4a1009
2 changed files with 35 additions and 6 deletions

View File

@ -1312,7 +1312,7 @@ Channel.prototype.tryUpdate = function(user, data) {
return; return;
} }
if(isLive(this.media.type)) { if(isLive(this.media.type) && this.media.type != "jw") {
return; return;
} }

View File

@ -389,20 +389,49 @@ Media.prototype.initJWPlayer = function() {
height: VHEIGHT, height: VHEIGHT,
autostart: true autostart: true
}); });
setTimeout(function() {$("#ytapiplayer_logo").remove();}, 1000);
jwplayer().onPlay(function() {
this.paused = false;
}.bind(this));
jwplayer().onPause(function() {
this.paused = true;
}.bind(this));
jwplayer().onComplete(function() {
socket.emit("playNext");
});
function removeLogo() {
if($("#ytapiplayer_logo").length > 0) {
$("#ytapiplayer_logo").remove();
}
else {
setTimeout(removeLogo, 100);
}
}
this.load = function(data) { this.load = function(data) {
this.id = data.id; this.id = data.id;
this.initJWPlayer(); this.initJWPlayer();
} }
this.pause = function() { } this.pause = function() {
jwplayer().pause(true);
}
this.play = function() { } this.play = function() {
jwplayer().play(true);
}
this.getTime = function() { } this.getTime = function(callback) {
// Only return time for non-live media
if(jwplayer().getDuration() != -1) {
callback(jwplayer().getPosition());
}
}
this.seek = function() { } this.seek = function(time) {
jwplayer().seek(time);
}
} }
Media.prototype.initUstream = function() { Media.prototype.initUstream = function() {