mirror of https://github.com/calzoneman/sync.git
Fix Leader bug and Rank bug
This commit is contained in:
parent
728f23a05b
commit
ad705e8779
|
@ -353,8 +353,10 @@ Channel.prototype.playNext = function() {
|
||||||
|
|
||||||
// Synchronize to a sync packet from the leader
|
// Synchronize to a sync packet from the leader
|
||||||
Channel.prototype.update = function(data) {
|
Channel.prototype.update = function(data) {
|
||||||
if(this.currentMedia == null)
|
if(this.currentMedia == null) {
|
||||||
this.currentMedia = data;
|
this.currentMedia = new Media(data.id, data.title, data.seconds, data.type);
|
||||||
|
this.currentMedia.currentTIme = data.currentTime;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
this.currentMedia.currentTime = data.seconds;
|
this.currentMedia.currentTime = data.seconds;
|
||||||
this.sendAll('mediaUpdate', this.currentMedia.packupdate());
|
this.sendAll('mediaUpdate', this.currentMedia.packupdate());
|
||||||
|
@ -469,8 +471,9 @@ Channel.prototype.demoteUser = function(actor, name) {
|
||||||
// but you never know
|
// but you never know
|
||||||
Channel.prototype.changeLeader = function(name) {
|
Channel.prototype.changeLeader = function(name) {
|
||||||
if(this.leader != null) {
|
if(this.leader != null) {
|
||||||
|
var old = leader;
|
||||||
this.leader = null;
|
this.leader = null;
|
||||||
this.broadcastRankUpdate(this.leader);
|
this.broadcastRankUpdate(old);
|
||||||
}
|
}
|
||||||
if(name == "") {
|
if(name == "") {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -165,6 +165,10 @@ function initCallbacks() {
|
||||||
else {
|
else {
|
||||||
sendVideoUpdate = function() { }
|
sendVideoUpdate = function() { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RANK = data.rank;
|
||||||
|
if(data.rank >= Rank.Moderator)
|
||||||
|
$('#playlist_controls').css("display", "block");
|
||||||
}
|
}
|
||||||
var users = $('#userlist').children();
|
var users = $('#userlist').children();
|
||||||
for(var i = 0; i < users.length; i++) {
|
for(var i = 0; i < users.length; i++) {
|
||||||
|
|
Loading…
Reference in New Issue