JWPlayer fixes

This commit is contained in:
calzoneman 2014-11-13 20:24:05 -06:00
parent 7310dabedf
commit 08f9aeaedb
2 changed files with 15 additions and 8 deletions

View File

@ -698,12 +698,17 @@ var JWPlayer = function (data) {
jwplayer("ytapiplayer").setup({ jwplayer("ytapiplayer").setup({
file: self.videoURL, file: self.videoURL,
width: VWIDTH, width: "100%",
height: VHEIGHT, height: "100%",
autostart: true, autostart: true,
type: data.contentType type: data.contentType
}); });
jwplayer().onReady(function() {
$("#ytapiplayer").addClass("embed-responsive-item");
handleVideoResize();
});
jwplayer().onPlay(function() { jwplayer().onPlay(function() {
self.paused = false; self.paused = false;
if(CLIENT.leader) if(CLIENT.leader)
@ -717,11 +722,17 @@ var JWPlayer = function (data) {
jwplayer().onComplete(function() { jwplayer().onComplete(function() {
socket.emit("playNext"); socket.emit("playNext");
}); });
self.setVolume(VOLUME); self.setVolume(VOLUME);
}; };
self.load = function (data) { self.load = function (data) {
self.videoId = data.id; self.videoId = data.id;
if (data.url) {
self.videoURL = data.url;
} else {
self.videoURL = data.id;
}
self.videoLength = data.seconds; self.videoLength = data.seconds;
self.init(); self.init();
}; };

View File

@ -1647,7 +1647,6 @@ function handleWindowResize() {
} }
function handleVideoResize() { function handleVideoResize() {
//console.trace();
var intv, ticks = 0; var intv, ticks = 0;
var resize = function () { var resize = function () {
if (++ticks > 10) clearInterval(intv); if (++ticks > 10) clearInterval(intv);
@ -1655,12 +1654,11 @@ function handleVideoResize() {
clearInterval(intv); clearInterval(intv);
var height = $("#ytapiplayer").height() - $("#chatline").outerHeight() - 2; var height = $("#ytapiplayer").height() - $("#chatline").outerHeight() - 2;
console.log(height);
$("#messagebuffer").height(height); $("#messagebuffer").height(height);
$("#userlist").height(height); $("#userlist").height(height);
//$("#ytapiplayer").attr("height", VHEIGHT = $("#ytapiplayer").height()); $("#ytapiplayer").attr("height", VHEIGHT = $("#ytapiplayer").height());
//$("#ytapiplayer").attr("width", VWIDTH = $("#ytapiplayer").width()); $("#ytapiplayer").attr("width", VWIDTH = $("#ytapiplayer").width());
}; };
if ($("#ytapiplayer").height() > 0) resize(); if ($("#ytapiplayer").height() > 0) resize();
@ -1668,9 +1666,7 @@ function handleVideoResize() {
} }
$(window).resize(handleWindowResize); $(window).resize(handleWindowResize);
//setInterval(function () { console.log($("#ytapiplayer").height()); }, 10);
handleWindowResize(); handleWindowResize();
console.log('after');
function removeVideo() { function removeVideo() {
try { try {