diff --git a/www/assets/js/player.js b/www/assets/js/player.js index fc456788..4ac399d3 100644 --- a/www/assets/js/player.js +++ b/www/assets/js/player.js @@ -58,6 +58,7 @@ var Player = function(data) { this.nullPlayer(); break; } + this.load(data); } Player.prototype.nullPlayer = function() { @@ -114,19 +115,23 @@ Player.prototype.initYouTube = function() { } this.pause = function() { - this.player.pauseVideo(); + if(this.player.pauseVideo) + this.player.pauseVideo(); } this.play = function() { - this.player.playVideo(); + if(this.player.playVideo) + this.player.playVideo(); } this.getTime = function(callback) { - callback(this.player.getCurrentTime()); + if(this.player.getCurrentTime) + callback(this.player.getCurrentTime()); } this.seek = function(time) { - this.player.seekTo(time, true); + if(this.player.seekTo) + this.player.seekTo(time, true); } } diff --git a/www/assets/js/ui.js b/www/assets/js/ui.js index e021ce0f..78468de5 100644 --- a/www/assets/js/ui.js +++ b/www/assets/js/ui.js @@ -190,6 +190,8 @@ $("#userpl_save").click(function() { var caret = btn.find(".caret").detach(); btn.text($(select).text()); caret.appendTo(btn); + if(PLAYER.type == "yt" && PLAYER.player.setPlaybackQuality) + PLAYER.player.setPlaybackQuality(VIDEOQUALITY); }); } qualHandler("#quality_240p", "small"); @@ -199,6 +201,12 @@ $("#userpl_save").click(function() { qualHandler("#quality_1080p", "hd1080"); })(); +$("#mediarefresh").click(function() { + PLAYER.type = ""; + PLAYER.id = ""; + socket.emit("playerReady"); +}); + /* playlist controls */ $("#queue").sortable({ diff --git a/www/channel.html b/www/channel.html index 0850022e..dc69c0f2 100644 --- a/www/channel.html +++ b/www/channel.html @@ -156,6 +156,7 @@