diff --git a/www/assets/js/data.js b/www/assets/js/data.js index 8e6f301a..2a15c721 100644 --- a/www/assets/js/data.js +++ b/www/assets/js/data.js @@ -33,6 +33,7 @@ var CHANNEL = { }; var PLAYER = false; +var VIDEOQUALITY = false; var FLUIDLAYOUT = false; if($("#ytapiplayer").length > 0) { var VWIDTH = $("#ytapiplayer").parent().css("width").replace("px", ""); diff --git a/www/assets/js/player.js b/www/assets/js/player.js index 6a914bfd..fc456788 100644 --- a/www/assets/js/player.js +++ b/www/assets/js/player.js @@ -76,8 +76,12 @@ Player.prototype.initYouTube = function() { width: VWIDTH, videoId: this.id, playerVars: { - "autoplay": 1, - "controls": 1, + autohide: 1, // Autohide controls + autoplay: 1, // Autoplay video + controls: 1, // Show controls + iv_load_policy: 3, // No annotations + modestbranding: 1, // No logo + rel: 0 // No related videos }, events: { onReady: function() { @@ -103,6 +107,8 @@ Player.prototype.initYouTube = function() { this.load = function(data) { if(this.player.loadVideoById) { this.player.loadVideoById(data.id, data.currentTime); + if(VIDEOQUALITY) + this.player.setPlaybackQuality(VIDEOQUALITY); this.id = data.id; } } diff --git a/www/assets/js/ui.js b/www/assets/js/ui.js index 4538380a..5fe67adf 100644 --- a/www/assets/js/ui.js +++ b/www/assets/js/ui.js @@ -181,6 +181,24 @@ $("#userpl_save").click(function() { }); }); +/* video controls */ +(function() { + function qualHandler(select, preset) { + $(select).click(function() { + VIDEOQUALITY = preset; + var btn = $("#qualitywrap .btn.dropdown-toggle"); + var caret = btn.find(".caret").detach(); + btn.text($(select).text()); + caret.appendTo(btn); + }); + } + qualHandler("#quality_240p", "small"); + qualHandler("#quality_360p", "medium"); + qualHandler("#quality_480p", "large"); + qualHandler("#quality_720p", "hd720"); + qualHandler("#quality_1080p", "hd1080"); +})(); + /* playlist controls */ $("#queue").sortable({ diff --git a/www/channel.html b/www/channel.html index c0b67a2d..0850022e 100644 --- a/www/channel.html +++ b/www/channel.html @@ -97,7 +97,7 @@
- +
@@ -143,7 +143,20 @@
-
+
+
+ + Quality + + +
+