mirror of https://github.com/calzoneman/sync.git
Fix end of playlist bug
This commit is contained in:
parent
259c72e7da
commit
9ede4dbc2d
|
@ -339,7 +339,6 @@ Channel.prototype.unqueue = function(data) {
|
||||||
Channel.prototype.playNext = function() {
|
Channel.prototype.playNext = function() {
|
||||||
if(this.currentPosition + 1 >= this.queue.length) {
|
if(this.currentPosition + 1 >= this.queue.length) {
|
||||||
this.currentMedia = null;
|
this.currentMedia = null;
|
||||||
this.currentPosition = -1;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.currentPosition++;
|
this.currentPosition++;
|
||||||
|
@ -570,7 +569,7 @@ var time = new Date().getTime();
|
||||||
function channelVideoUpdate(chan, id) {
|
function channelVideoUpdate(chan, id) {
|
||||||
// Someone changed the video or there's a manual leader, so your
|
// Someone changed the video or there's a manual leader, so your
|
||||||
// argument is invalid
|
// argument is invalid
|
||||||
if(id != chan.currentMedia.id || chan.leader != null)
|
if(chan.currentMedia == null || id != chan.currentMedia.id || chan.leader != null)
|
||||||
return;
|
return;
|
||||||
// Add dt since last update
|
// Add dt since last update
|
||||||
chan.currentMedia.currentTime += (new Date().getTime() - time)/1000.0;
|
chan.currentMedia.currentTime += (new Date().getTime() - time)/1000.0;
|
||||||
|
|
3
user.js
3
user.js
|
@ -116,6 +116,9 @@ User.prototype.initCallbacks = function() {
|
||||||
this.socket.on('playNext', function() {
|
this.socket.on('playNext', function() {
|
||||||
if(Rank.hasPermission(this, "queue") ||
|
if(Rank.hasPermission(this, "queue") ||
|
||||||
(this.channel != null && this.channel.leader == this)) {
|
(this.channel != null && this.channel.leader == this)) {
|
||||||
|
if(this.channel.currentPosition + 1 >= this.channel.queue.length) {
|
||||||
|
this.channel.currentPosition = -1;
|
||||||
|
}
|
||||||
this.channel.playNext();
|
this.channel.playNext();
|
||||||
}
|
}
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
Loading…
Reference in New Issue