Add volume normalization and vimeo workaround

This commit is contained in:
calzoneman 2014-02-02 20:04:50 -06:00
parent 1864cc0b35
commit e6acf92bdb
8 changed files with 455 additions and 85 deletions

View File

@ -71,3 +71,6 @@ aliases:
purge-interval: 3600000
# Maximum age of an alias (in milliseconds) - default 1 month
max-age: 2592000000
# Workaround for Vimeo blocking my domain
vimeo-workaround: false

View File

@ -704,6 +704,87 @@ var Getters = {
}
};
/**
* Function to workaround Vimeo being a dick and blocking my domain from embeds.
* Retrieves the player page and extracts the direct links to the MP4 encoded videos.
*/
function vimeoWorkaround(id, cb) {
if (typeof cb !== "function") {
return;
}
var failcount = 0;
var inner = function () {
var options = {
host: "player.vimeo.com",
path: "/video/" + id,
headers: {
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:29.0) Gecko/20100101 Firefox/29.0",
"Referrer": "player.vimeo.com"
}
};
var parse = function (data) {
var i = data.indexOf("b={");
var j = data.indexOf("};", i);
var json = data.substring(i+2, j+1);
try {
json = JSON.parse(json);
var codec = json.request.files.codecs[0];
var files = json.request.files[codec];
setImmediate(function () {
cb(files);
});
} catch (e) {
// This shouldn't happen due to the user-agent, but just in case
if (data.indexOf("crawler") !== -1) {
Logger.syslog.log("Warning: VimeoIsADoucheCopter got crawler response");
failcount++;
if (failcount > 4) {
Logger.errlog.log("VimeoIsADoucheCopter got bad response 5 times!"+
" Giving up.");
setImmediate(function () {
cb({});
});
} else {
setImmediate(function () {
inner();
});
}
return;
} else if (data.indexOf("This video does not exist.") !== -1) {
cb({});
return;
} else if (data.indexOf("Because of its privacy settings, this video cannot be played here.") !== -1) {
cb({});
}
Logger.errlog.log("Vimeo workaround error: ");
Logger.errlog.log(e);
Logger.errlog.log(data);
setImmediate(function () {
cb({});
});
}
};
http.get(options, function (res) {
res.setEncoding("utf-8");
var buffer = "";
res.on("data", function (data) {
buffer += data;
});
res.on("end", function () {
parse(buffer);
});
});
};
inner();
}
module.exports = {
Getters: Getters,
getMedia: function (id, type, callback) {
@ -712,5 +793,7 @@ module.exports = {
} else {
callback("Unknown media type '" + type + "'", null);
}
}
},
vimeoWorkaround: vimeoWorkaround
};

View File

@ -1,11 +1,11 @@
/*
The MIT License (MIT)
Copyright (c) 2013 Calvin Montgomery
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
@ -40,7 +40,7 @@ Media.prototype.pack = function() {
duration: this.duration,
type: this.type,
};
if (this.object) {
x.object = this.object;
}
@ -68,6 +68,9 @@ Media.prototype.fullupdate = function() {
if (this.params) {
x.params = this.params;
}
if (this.direct) {
x.direct = this.direct;
}
return x;
}
@ -79,4 +82,9 @@ Media.prototype.timeupdate = function() {
};
}
Media.prototype.reset = function () {
delete this.currentTime;
delete this.direct;
};
exports.Media = Media;

View File

@ -9,9 +9,12 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
ULList = require("./ullist").ULList;
var ULList = require("./ullist").ULList;
var AsyncQueue = require("./asyncqueue");
var Media = require("./media").Media;
var util = require("./utilities");
var vimeoWorkaround = require("./get-info").vimeoWorkaround;
var Config = require("./config");
var AllPlaylists = {};
function PlaylistItem(media, uid) {
@ -349,44 +352,47 @@ Playlist.prototype.lead = function(lead) {
}
Playlist.prototype.startPlayback = function (time) {
if(!this.current || !this.current.media)
var self = this;
if(!self.current || !self.current.media)
return false;
if (!this.leading) {
this.current.media.paused = false;
this.current.media.currentTime = time || 0;
this.on("changeMedia")(this.current.media);
if (self.current.media.type === "vi" &&
!self.current.media.direct &&
Config.get("vimeo-workaround")) {
vimeoWorkaround(self.current.media.id, function (direct) {
if (self.current != null && self.current.media != null) {
self.current.media.direct = direct;
self.startPlayback(time);
}
});
return;
}
if (!self.leading) {
self.current.media.paused = false;
self.current.media.currentTime = time || 0;
self.on("changeMedia")(self.current.media);
return;
}
time = time || -3;
this.current.media.paused = time < 0;
this.current.media.currentTime = time;
self.current.media.paused = time < 0;
self.current.media.currentTime = time;
var pl = this;
if(this._leadInterval) {
clearInterval(this._leadInterval);
this._leadInterval = false;
if(self._leadInterval) {
clearInterval(self._leadInterval);
self._leadInterval = false;
}
this.on("changeMedia")(this.current.media);
if(!isLive(this.current.media.type)) {
this._lastUpdate = Date.now();
this._leadInterval = setInterval(function() {
pl._leadLoop();
self.on("changeMedia")(self.current.media);
if(!util.isLive(self.current.media.type)) {
self._lastUpdate = Date.now();
self._leadInterval = setInterval(function() {
self._leadLoop();
}, 1000);
}
}
function isLive(type) {
return type == "li" // Livestream.com
|| type == "tw" // Twitch.tv
|| type == "jt" // Justin.tv
|| type == "rt" // RTMP
|| type == "jw" // JWPlayer
|| type == "us" // Ustream.tv
|| type == "im" // Imgur album
|| type == "cu";// Custom embed
}
const UPDATE_INTERVAL = 5;
Playlist.prototype._leadLoop = function() {

View File

@ -189,6 +189,7 @@ module.exports = {
case "us":
case "rt":
case "cu":
case "im":
case "jw":
return true;
default:

View File

@ -766,6 +766,15 @@ Callbacks = {
},
changeMedia: function(data) {
if (PLAYER && typeof PLAYER.getVolume === "function") {
PLAYER.getVolume(function (v) {
if (typeof v === "number") {
VOLUME = v;
setOpt("volume", VOLUME);
}
});
}
if(CHANNEL.opts.allow_voteskip)
$("#voteskip").attr("disabled", false);
@ -782,6 +791,31 @@ Callbacks = {
$("#ytapiplayer_wrapper").remove();
}
/*
VIMEO SIMULATOR 2014
Vimeo decided to block my domain. After repeated emails, they refused to
unblock it. Rather than give in to their demands, there is a serverside
option which extracts direct links to the h264 encoded MP4 video files.
These files can be loaded in a custom player to allow Vimeo playback without
triggering their dumb API domain block.
It's a little bit hacky, but my only other option is to keep buying new
domains every time one gets blocked. No thanks to Vimeo, who were of no help
and unwilling to compromise on the issue.
*/
if (NO_VIMEO && data.type === "vi" && data.direct && data.direct.sd) {
// For browsers that don't support native h264 playback
if (USEROPTS.no_h264) {
data.type = "jw";
} else {
data.type = "rv";
}
// Right now only plays standard definition.
// In the future, I may add a quality selector for mobile/standard/HD
data.url = data.direct.sd.url;
}
if(data.type != PLAYER.type) {
loadMediaPlayer(data);
}

View File

@ -122,7 +122,10 @@ var USEROPTS = {
secure_connection : getOrDefault("secure_connection", false)
};
var VOLUME = parseFloat(getOrDefault("volume", 1));
var NO_WEBSOCKETS = USEROPTS.altsocket;
var NO_VIMEO = Boolean(location.host.match("cytu.be"));
var Rank = {
Guest: 0,

View File

@ -1,4 +1,4 @@
/*
/*}
The MIT License (MIT)
Copyright (c) 2013 Calvin Montgomery
@ -43,7 +43,7 @@ var YouTubePlayer = function (data) {
},
events: {
onReady: function () {
resizeStuff();
PLAYER.setVolume(VOLUME);
},
onStateChange: function (ev) {
if(PLAYER.paused && ev.data != YT.PlayerState.PAUSED ||
@ -68,10 +68,10 @@ var YouTubePlayer = function (data) {
self.load = function (data) {
if(self.player && self.player.loadVideoById) {
self.player.loadVideoById(data.id, data.currentTime);
if (USEROPTS.default_quality && USEROPTS.default_quality !== "auto") {
self.player.setPlaybackQuality(USEROPTS.default_quality);
if(VIDEOQUALITY) {
self.player.setPlaybackQuality(VIDEOQUALITY);
// What's that? Another stupid hack for the HTML5 player?
self.player.setPlaybackQuality(USEROPTS.default_quality);
self.player.setPlaybackQuality(VIDEOQUALITY);
}
self.videoId = data.id;
self.videoLength = data.seconds;
@ -106,6 +106,27 @@ var YouTubePlayer = function (data) {
if(self.player && self.player.seekTo)
self.player.seekTo(time, true);
};
self.getVolume = function (cb) {
if (!self.player || !self.player.getVolume || !self.player.isMuted) {
return;
}
// YouTube's API is strange in the sense that getVolume() returns
// the regular (unmuted) volume even if it is muted...
// YouTube's volume is 0..100, normalize it to 0..1
var vol = self.player.isMuted() ? 0 : (self.player.getVolume() / 100);
cb(vol);
};
self.setVolume = function (vol) {
if (self.player && self.player.setVolume) {
if (vol > 0) {
self.player.unMute();
}
self.player.setVolume(vol * 100);
}
};
};
var VimeoPlayer = function (data) {
@ -148,11 +169,11 @@ var VimeoPlayer = function (data) {
if(CLIENT.leader)
sendVideoUpdate();
});
self.setVolume(VOLUME);
}.bind(self));
};
self.init();
self.load = function (data) {
self.videoId = data.id;
self.videoLength = data.seconds;
@ -186,6 +207,18 @@ var VimeoPlayer = function (data) {
if(self.player && self.player.api)
self.player.api("seekTo", time);
};
self.getVolume = function (cb) {
if (self.player && self.player.api) {
self.player.api("getVolume", cb);
}
};
self.setVolume = function (vol) {
self.player.api("setVolume", vol);
};
self.init();
});
};
@ -245,12 +278,12 @@ var VimeoFlashPlayer = function (data) {
if(CLIENT.leader)
sendVideoUpdate();
});
self.setVolume(VOLUME);
});
});
};
self.init();
self.load = function (data) {
self.videoId = data.id;
self.videoLength = data.seconds;
@ -282,6 +315,18 @@ var VimeoFlashPlayer = function (data) {
if(self.player.api_seekTo);
self.player.api_seekTo(time);
};
self.getVolume = function (cb) {
if (self.player && self.player.api_getVolume) {
cb(self.player.api_getVolume());
}
};
self.setVolume = function (vol) {
self.player.api_setVolume(vol);
};
self.init();
};
var DailymotionPlayer = function (data) {
@ -314,6 +359,14 @@ var DailymotionPlayer = function (data) {
PLAYER.paused = false;
if(CLIENT.leader)
sendVideoUpdate();
if (!self.volumeIsSet) {
try {
self.setVolume(VOLUME);
self.volumeIsSet = true;
} catch (err) {
}
}
});
});
});
@ -321,8 +374,9 @@ var DailymotionPlayer = function (data) {
self.load = function (data) {
self.videoId = data.id;
self.videoLength = data.seconds;
if(self.player && self.player.api)
if (self.player && self.player.api) {
self.player.api("load", data.id);
}
};
self.pause = function () {
@ -348,10 +402,25 @@ var DailymotionPlayer = function (data) {
if(self.player && self.player.api)
self.player.api("seek", seconds);
};
self.getVolume = function (cb) {
if (self.player) {
cb(self.player.volume);
}
};
self.setVolume = function (vol) {
if (self.player && self.player.api) {
self.player.api("volume", vol);
}
};
};
var SoundcloudPlayer = function (data) {
var self = this;
// The getVolume function on their widget throws TypeErrors
// Go figure
self.soundcloudIsSeriouslyFuckingBroken = VOLUME;
self.videoId = data.id;
self.videoLength = data.seconds;
waitUntilDefined(window, "SC", function () {
@ -369,9 +438,10 @@ var SoundcloudPlayer = function (data) {
volslider.slider({
range: "min",
value: 100,
value: VOLUME * 100,
stop: function (event, ui) {
self.player.setVolume(ui.value);
self.soundcloudIsSeriouslyFuckingBroken = ui.value / 100;
}
});
@ -386,25 +456,38 @@ var SoundcloudPlayer = function (data) {
sendVideoUpdate();
});
self.player.bind(SC.Widget.Events.FINISH, function () {
if(CLIENT.leader) {
socket.emit("playNext");
}
});
self.player.bind(SC.Widget.Events.PLAY, function () {
PLAYER.paused = false;
if(CLIENT.leader)
sendVideoUpdate();
});
self.player.bind(SC.Widget.Events.FINISH, function () {
if(CLIENT.leader) {
socket.emit("playNext");
}
});
// THAT'S RIGHT, YOU CAN'T SET THE VOLUME BEFORE IT STARTS PLAYING
var soundcloudNeedsToFuckingFixTheirPlayer = function () {
self.setVolume(VOLUME);
self.player.unbind(SC.Widget.Events.PLAY_PROGRESS);
};
self.player.bind(SC.Widget.Events.PLAY_PROGRESS, soundcloudNeedsToFuckingFixTheirPlayer);
}.bind(self));
});
self.load = function (data) {
self.videoId = data.id;
self.videoLength = data.seconds;
if(self.player && self.player.load)
if(self.player && self.player.load) {
self.player.load(data.id, { auto_play: true });
var soundcloudNeedsToFuckingFixTheirPlayer = function () {
self.setVolume(VOLUME);
self.player.unbind(SC.Widget.Events.PLAY_PROGRESS);
};
self.player.bind(SC.Widget.Events.PLAY_PROGRESS, soundcloudNeedsToFuckingFixTheirPlayer);
}
};
self.pause = function () {
@ -436,6 +519,14 @@ var SoundcloudPlayer = function (data) {
if(self.player && self.player.seekTo)
self.player.seekTo(seconds * 1000);
};
self.getVolume = function (cb) {
cb(self.soundcloudIsSeriouslyFuckingBroken);
};
self.setVolume = function (vol) {
self.player.setVolume(vol * 100);
};
};
var LivestreamPlayer = function (data) {
@ -458,8 +549,6 @@ var LivestreamPlayer = function (data) {
);
};
self.init();
self.load = function(data) {
self.videoId = data.id;
self.videoLength = data.seconds;
@ -475,6 +564,12 @@ var LivestreamPlayer = function (data) {
self.getTime = function () { };
self.seek = function () { };
self.getVolume = function () { };
self.setVolume = function () { };
self.init();
};
var TwitchTVPlayer = function (data) {
@ -490,22 +585,18 @@ var TwitchTVPlayer = function (data) {
allowNetworking: "all",
movie: "http://www.twitch.tv/widgets/live_embed_player.swf",
id: "live_embed_player_flash",
flashvars: "hostname=www.twitch.tv&channel="+self.videoId+"&auto_play=true&start_volume=100"
flashvars: "hostname=www.twitch.tv&channel="+self.videoId+"&auto_play=true&start_volume=" + VOLUME
};
swfobject.embedSWF(url,
"ytapiplayer",
VWIDTH, VHEIGHT,
"8",
"8",
null, null,
params,
{}
);
};
waitUntilDefined(window, "swfobject", function () {
self.init();
});
self.load = function (data) {
self.videoId = data.id;
self.videoLength = data.seconds;
@ -521,6 +612,14 @@ var TwitchTVPlayer = function (data) {
self.getTime = function () { };
self.seek = function () { };
self.getVolume = function () { };
self.setVolume = function () { };
waitUntilDefined(window, "swfobject", function () {
self.init();
});
};
var JustinTVPlayer = function (data) {
@ -537,22 +636,18 @@ var JustinTVPlayer = function (data) {
allowNetworking: "all",
movie: "http://www.justin.tv/widgets/live_embed_player.swf",
id: "live_embed_player_flash",
flashvars: "hostname=www.justin.tv&channel="+self.videoId+"&auto_play=true&start_volume=100"
flashvars: "hostname=www.justin.tv&channel="+self.videoId+"&auto_play=true&start_volume=" + VOLUME
};
swfobject.embedSWF(url,
"ytapiplayer",
VWIDTH, VHEIGHT,
"8",
"8",
null, null,
params,
{}
);
};
waitUntilDefined(window, "swfobject", function () {
self.init();
});
self.load = function (data) {
self.videoId = data.id;
self.videoLength = data.seconds;
@ -568,11 +663,26 @@ var JustinTVPlayer = function (data) {
self.getTime = function () { };
self.seek = function () { };
self.getVolume = function () { };
self.setVolume = function () { };
waitUntilDefined(window, "swfobject", function () {
self.init();
});
};
function rtmpEventHandler(id, ev, data) {
if (ev === "volumechange") {
PLAYER.volume = (data.muted ? 0 : data.volume);
}
}
var RTMPPlayer = function (data) {
removeOld();
var self = this;
var self =this;
self.volume = VOLUME;
self.videoId = data.id;
self.videoLength = data.seconds;
self.init = function () {
@ -585,7 +695,7 @@ var RTMPPlayer = function (data) {
allowNetworking: "all",
wMode: "direct",
movie: prto+"//fpdownload.adobe.com/strobe/FlashMediaPlayback_101.swf",
flashvars: "src="+src+"&streamType=live&autoPlay=true"
flashvars: "src="+src+"&streamType=live&javascriptCallbackFunction=rtmpEventHandler&autoPlay=true&volume=" + VOLUME
};
swfobject.embedSWF(url,
"ytapiplayer",
@ -597,10 +707,6 @@ var RTMPPlayer = function (data) {
);
};
waitUntilDefined(window, "swfobject", function () {
self.init();
});
self.load = function (data) {
self.videoId = data.id;
self.videoLength = data.seconds;
@ -616,22 +722,36 @@ var RTMPPlayer = function (data) {
self.getTime = function () { };
self.seek = function () { };
self.getVolume = function (cb) {
cb(self.volume);
};
self.setVolume = function () { };
waitUntilDefined(window, "swfobject", function () {
self.init();
});
};
var JWPlayer = function (data) {
var self = this;
self.videoId = data.id;
if (data.url) {
self.videoURL = data.url;
} else {
self.videoURL = data.id;
}
self.videoLength = data.seconds;
self.init = function () {
removeOld();
jwplayer("ytapiplayer").setup({
file: self.videoId,
file: self.videoURL,
width: VWIDTH,
height: VHEIGHT,
autostart: true
});
jwplayer().onPlay(function() {
self.paused = false;
if(CLIENT.leader)
@ -645,10 +765,9 @@ var JWPlayer = function (data) {
jwplayer().onComplete(function() {
socket.emit("playNext");
});
self.setVolume(VOLUME);
};
waitUntilDefined(window, "jwplayer", function () { self.init(); });
self.load = function (data) {
self.videoId = data.id;
self.videoLength = data.seconds;
@ -681,6 +800,16 @@ var JWPlayer = function (data) {
if(jwplayer)
jwplayer().seek(time);
};
self.getVolume = function (cb) {
cb(jwplayer().getVolume() / 100);
};
self.setVolume = function (vol) {
jwplayer().setVolume(vol * 100);
};
waitUntilDefined(window, "jwplayer", function () { self.init(); });
};
var UstreamPlayer = function (data) {
@ -698,8 +827,6 @@ var UstreamPlayer = function (data) {
iframe.attr("scrolling", "no");
iframe.css("border", "none");
};
self.init();
self.load = function (data) {
self.videoId = data.id;
@ -716,6 +843,12 @@ var UstreamPlayer = function (data) {
self.getTime = function () { };
self.seek = function () { };
self.getVolume = function () { };
self.setVolume = function () { };
self.init();
};
var ImgurPlayer = function (data) {
@ -732,8 +865,6 @@ var ImgurPlayer = function (data) {
iframe.css("border", "none");
};
self.init();
self.load = function (data) {
self.videoId = data.id;
self.videoLength = data.seconds;
@ -749,6 +880,12 @@ var ImgurPlayer = function (data) {
self.getTime = function () { };
self.seek = function () { };
self.getVolume = function () { };
self.setVolume = function () { };
self.init();
};
var CustomPlayer = function (data) {
@ -769,8 +906,6 @@ var CustomPlayer = function (data) {
self.player.attr("height", VHEIGHT);
};
self.init();
self.load = function (data) {
self.videoId = data.id;
self.videoLength = data.seconds;
@ -786,6 +921,12 @@ var CustomPlayer = function (data) {
self.getTime = function () { };
self.seek = function () { };
self.getVolume = function () { };
self.setVolume = function () { };
self.init();
};
var GoogleDocsPlayer = function (data) {
@ -803,10 +944,9 @@ var GoogleDocsPlayer = function (data) {
$("<param/>", p).appendTo(self.player);
});
removeOld($(self.player));
self.setVolume(VOLUME);
};
self.init(data);
self.load = function (data) {
self.init(data);
};
@ -839,13 +979,104 @@ var GoogleDocsPlayer = function (data) {
if(self.player && self.player.seekTo)
self.player.seekTo(time, true);
};
self.getVolume = function (cb) {
if (!self.player || !self.player.getVolume || !self.player.isMuted) {
return;
}
// YouTube's API is strange in the sense that getVolume() returns
// the regular (unmuted) volume even if it is muted...
// YouTube's volume is 0..100, normalize it to 0..1
var vol = self.player.isMuted() ? 0 : (self.player.getVolume() / 100);
cb(vol);
};
self.setVolume = function (vol) {
if (self.player && self.player.setVolume) {
self.player.setVolume(vol * 100);
}
};
self.init(data);
};
function RawVideoPlayer(data) {
var self = this;
self.init = function (data) {
self.videoId = data.id;
self.videoURL = data.url;
var video = $("<video/>")
.attr("src", self.videoURL)
.attr("controls", "controls")
.attr("id", "#ytapiplayer")
.attr("width", VWIDTH)
.attr("height", VHEIGHT)
.html("Your browser does not support HTML5 <code>&lt;video&gt;</code> tags :(");
removeOld(video);
self.player = video[0];
self.setVolume(VOLUME);
};
self.load = function (data) {
self.init(data);
};
self.pause = function () {
if (self.player) {
self.player.pause();
}
};
self.play = function () {
if (self.player) {
self.player.play();
}
};
self.isPaused = function (callback) {
if (self.player) {
callback(self.player.paused);
}
};
self.getTime = function (callback) {
if (self.player) {
callback(self.player.currentTime);
}
};
self.seek = function (time) {
if (self.player) {
self.player.currentTime = time;
}
};
self.getVolume = function (cb) {
if (self.player) {
if (self.player.muted) {
cb(0);
} else {
cb(self.player.volume);
}
}
};
self.setVolume = function (vol) {
if (self.player) {
self.player.volume = vol;
}
};
self.init(data);
};
function handleMediaUpdate(data) {
// Don't update if the position is past the video length, but
// make an exception when the video length is 0 seconds
if (typeof PLAYER.videoLength === "number") {
if (PLAYER.videoLength > 0 &&
if (PLAYER.videoLength > 0 &&
data.currentTime > PLAYER.videoLength) {
return;
}
@ -876,7 +1107,7 @@ function handleMediaUpdate(data) {
}, tm);
return;
}
// Don't synch if leader or synch disabled
if(CLIENT.leader || !USEROPTS.synch)
return;
@ -937,7 +1168,8 @@ var constructors = {
"jw": JWPlayer,
"im": ImgurPlayer,
"cu": CustomPlayer,
"gd": GoogleDocsPlayer
"gd": GoogleDocsPlayer,
"rv": RawVideoPlayer
};
function loadMediaPlayer(data) {