diff --git a/channel.js b/channel.js index 742234e4..64fd15aa 100644 --- a/channel.js +++ b/channel.js @@ -353,8 +353,10 @@ Channel.prototype.playNext = function() { // Synchronize to a sync packet from the leader Channel.prototype.update = function(data) { - if(this.currentMedia == null) - this.currentMedia = data; + if(this.currentMedia == null) { + this.currentMedia = new Media(data.id, data.title, data.seconds, data.type); + this.currentMedia.currentTIme = data.currentTime; + } else this.currentMedia.currentTime = data.seconds; this.sendAll('mediaUpdate', this.currentMedia.packupdate()); @@ -469,8 +471,9 @@ Channel.prototype.demoteUser = function(actor, name) { // but you never know Channel.prototype.changeLeader = function(name) { if(this.leader != null) { + var old = leader; this.leader = null; - this.broadcastRankUpdate(this.leader); + this.broadcastRankUpdate(old); } if(name == "") { return; diff --git a/www/assets/js/callbacks.js b/www/assets/js/callbacks.js index 0480b072..58ec5856 100644 --- a/www/assets/js/callbacks.js +++ b/www/assets/js/callbacks.js @@ -165,6 +165,10 @@ function initCallbacks() { else { sendVideoUpdate = function() { } } + + RANK = data.rank; + if(data.rank >= Rank.Moderator) + $('#playlist_controls').css("display", "block"); } var users = $('#userlist').children(); for(var i = 0; i < users.length; i++) {