diff --git a/www/js/player.js b/www/js/player.js index 27716cc3..95e33e21 100644 --- a/www/js/player.js +++ b/www/js/player.js @@ -698,12 +698,17 @@ var JWPlayer = function (data) { jwplayer("ytapiplayer").setup({ file: self.videoURL, - width: VWIDTH, - height: VHEIGHT, + width: "100%", + height: "100%", autostart: true, type: data.contentType }); + jwplayer().onReady(function() { + $("#ytapiplayer").addClass("embed-responsive-item"); + handleVideoResize(); + }); + jwplayer().onPlay(function() { self.paused = false; if(CLIENT.leader) @@ -717,11 +722,17 @@ var JWPlayer = function (data) { jwplayer().onComplete(function() { socket.emit("playNext"); }); + self.setVolume(VOLUME); }; self.load = function (data) { self.videoId = data.id; + if (data.url) { + self.videoURL = data.url; + } else { + self.videoURL = data.id; + } self.videoLength = data.seconds; self.init(); }; diff --git a/www/js/util.js b/www/js/util.js index f7146e48..f85da5ef 100644 --- a/www/js/util.js +++ b/www/js/util.js @@ -1647,7 +1647,6 @@ function handleWindowResize() { } function handleVideoResize() { - //console.trace(); var intv, ticks = 0; var resize = function () { if (++ticks > 10) clearInterval(intv); @@ -1655,12 +1654,11 @@ function handleVideoResize() { clearInterval(intv); var height = $("#ytapiplayer").height() - $("#chatline").outerHeight() - 2; - console.log(height); $("#messagebuffer").height(height); $("#userlist").height(height); - //$("#ytapiplayer").attr("height", VHEIGHT = $("#ytapiplayer").height()); - //$("#ytapiplayer").attr("width", VWIDTH = $("#ytapiplayer").width()); + $("#ytapiplayer").attr("height", VHEIGHT = $("#ytapiplayer").height()); + $("#ytapiplayer").attr("width", VWIDTH = $("#ytapiplayer").width()); }; if ($("#ytapiplayer").height() > 0) resize(); @@ -1668,9 +1666,7 @@ function handleVideoResize() { } $(window).resize(handleWindowResize); -//setInterval(function () { console.log($("#ytapiplayer").height()); }, 10); handleWindowResize(); -console.log('after'); function removeVideo() { try {