JWPlayer serverside synchronization
This commit is contained in:
parent
55b6e99896
commit
0f9bfe1429
3 changed files with 44 additions and 4 deletions
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue