JWPlayer serverside synchronization

This commit is contained in:
calzoneman 2014-02-09 20:10:11 -06:00
parent 55b6e99896
commit 0f9bfe1429
3 changed files with 44 additions and 4 deletions

View file

@ -1514,6 +1514,12 @@ Channel.prototype.handleQueue = function (user, data) {
var queueby = user != null ? user.name : "";
var temp = data.temp || !this.hasPermission(user, "addnontemp");
// Allow override of duration for live content
var duration = undefined;
if (util.isLive(data.type) && typeof data.duration === "number") {
duration = !isNaN(data.duration) ? data.duration : undefined;
}
// Throttle video adds
var limit = {
burst: 3,
@ -1543,6 +1549,7 @@ Channel.prototype.handleQueue = function (user, data) {
queueby: queueby,
temp: temp,
type: type,
duration: duration,
maxlength: this.hasPermission(user, "exceedmaxlength") ? 0 : this.opts.maxlength
}, function (err, media) {
if (err) {
@ -1681,6 +1688,12 @@ Channel.prototype.addMedia = function (data, callback) {
return;
}
if (data.duration) {
media.seconds = data.duration;
media.live = false;
} else {
media.live = true;
}
afterLookup(lock, false, media);
});
});

View file

@ -181,7 +181,8 @@ Playlist.prototype.add = function(item, pos) {
self.channel.sendAll("delete", {
uid: it.uid
});
self.channel.broadcastPlaylistMeta();
self.channel.updatePlaylistMeta();
self.channel.sendPlaylistMeta(self.channel.users);
}
if(pos == "append") {
@ -387,7 +388,7 @@ Playlist.prototype.startPlayback = function (time) {
self._leadInterval = false;
}
self.on("changeMedia")(self.current.media);
if(!util.isLive(self.current.media.type)) {
if(!self.current.media.live) {
self._lastUpdate = Date.now();
self._leadInterval = setInterval(function() {
self._leadLoop();
@ -453,7 +454,8 @@ Playlist.prototype.clean = function (filter) {
deleteNext();
} else {
// refresh meta only once, at the end
self.channel.broadcastPlaylistMeta();
self.channel.updatePlaylistMeta();
self.channel.sendPlaylistMeta(self.channel.users);
}
};
// start initial callback