diff --git a/lib/channel/playlist.js b/lib/channel/playlist.js index c5b99102..ae9c12f1 100644 --- a/lib/channel/playlist.js +++ b/lib/channel/playlist.js @@ -219,6 +219,9 @@ PlaylistModule.prototype.onUserPostJoin = function (user) { user.socket.on("shufflePlaylist", this.handleShuffle.bind(this, user)); /* User playlists */ user.socket.on("listPlaylists", this.handleListPlaylists.bind(this, user)); + if (user.is(Flags.U_REGISTERED)) { + this.handleListPlaylists(user); + } user.socket.typecheckedOn("clonePlaylist", TYPE_CLONE_PLAYLIST, this.handleClonePlaylist.bind(this, user)); user.socket.typecheckedOn("deletePlaylist", TYPE_CLONE_PLAYLIST, this.handleDeletePlaylist.bind(this, user)); user.socket.typecheckedOn("queuePlaylist", TYPE_QUEUE_PLAYLIST, this.handleQueuePlaylist.bind(this, user)); @@ -1018,7 +1021,7 @@ PlaylistModule.prototype.startPlayback = function (time) { } /* Lead-in time of 3 seconds to allow clients to buffer */ - time = time || -3; + time = time || (media.seconds > 0 ? -3 : 0); media.paused = time < 0; media.currentTime = time; diff --git a/lib/database.js b/lib/database.js index bb4e24b5..1faecbac 100644 --- a/lib/database.js +++ b/lib/database.js @@ -404,14 +404,14 @@ module.exports.saveUserPlaylist = function (pl, username, plname, callback) { var e = { id: pl[i].media.id, title: pl[i].media.title, - seconds: pl[i].media.seconds, + seconds: pl[i].media.seconds || 0, type: pl[i].media.type, meta: { codec: pl[i].media.meta.codec, bitrate: pl[i].media.meta.bitrate } }; - time += pl[i].media.seconds; + time += pl[i].media.seconds || 0; tmp.push(e); } var count = tmp.length; diff --git a/lib/ffmpeg.js b/lib/ffmpeg.js index 921cbb6b..276e85b2 100644 --- a/lib/ffmpeg.js +++ b/lib/ffmpeg.js @@ -52,7 +52,7 @@ exports.query = function (filename, cb) { var data = { title: meta.title || "Raw Video", - duration: Math.ceil(meta.seconds), + duration: Math.ceil(meta.seconds) || "--:--", bitrate: meta.bitrate, codec: codec }; @@ -67,7 +67,7 @@ exports.query = function (filename, cb) { var data = { title: meta.title || "Raw Audio", - duration: Math.ceil(meta.seconds), + duration: Math.ceil(meta.seconds) || "--:--", bitrate: meta.bitrate, codec: codec }; diff --git a/lib/get-info.js b/lib/get-info.js index c4cf20e6..5d2f4900 100644 --- a/lib/get-info.js +++ b/lib/get-info.js @@ -52,6 +52,7 @@ var urlRetrieve = function (transport, options, callback) { Logger.errlog.log(err.stack); Logger.errlog.log("urlRetrieve failed: " + err); Logger.errlog.log("Request was: " + options.host + options.path); + callback(503, ""); }); d.run(function () { var req = transport.request(options, function (res) { diff --git a/www/js/callbacks.js b/www/js/callbacks.js index 92134896..0e8f563b 100644 --- a/www/js/callbacks.js +++ b/www/js/callbacks.js @@ -418,9 +418,6 @@ Callbacks = { /* REGION Rank Stuff */ rank: function(r) { - if (r >= 1) { - socket.emit("listPlaylists"); - } if(r >= 255) SUPERADMIN = true; CLIENT.rank = r; @@ -840,7 +837,7 @@ Callbacks = { } /* Failsafe */ - if (isNaN(VOLUME)) { + if (isNaN(VOLUME) || VOLUME > 1 || VOLUME < 0) { VOLUME = 1; } @@ -849,8 +846,14 @@ Callbacks = { if (PLAYER && typeof PLAYER.getVolume === "function") { PLAYER.getVolume(function (v) { if (typeof v === "number") { - VOLUME = v; - setOpt("volume", VOLUME); + if (v < 0 || v > 1) { + alert("Something went wrong with retrieving the volume. " + + "Please tell calzoneman the following: " + + JSON.stringify({ v: v, t: PLAYER.type, i: PLAYER.videoId })); + } else { + VOLUME = v; + setOpt("volume", VOLUME); + } } }); } diff --git a/www/js/player.js b/www/js/player.js index ba4fddaf..9c1029af 100644 --- a/www/js/player.js +++ b/www/js/player.js @@ -706,11 +706,19 @@ var JWPlayer = function (data) { jwplayer().onReady(function() { $("#ytapiplayer").addClass("embed-responsive-item"); - $("#ytapiplayer").parent().css("position", "absolute"); + if ($("#ytapiplayer")[0].tagName === "OBJECT") { + $("#ytapiplayer").parent().css("position", "absolute"); + } handleVideoResize(); }); jwplayer().onPlay(function() { + /* Somehow JWPlayer manages to have THE SAME PROBLEM AS SOUNDCLOUD. + * It seems to be impossible to set the volume before the video has + * started playing. How this is so damn difficult to get right I will + * never understand. + */ + self.setVolume(VOLUME); self.paused = false; if(CLIENT.leader) sendVideoUpdate(); @@ -723,8 +731,6 @@ var JWPlayer = function (data) { jwplayer().onComplete(function() { socket.emit("playNext"); }); - - self.setVolume(VOLUME); }; self.load = function (data) { @@ -898,15 +904,18 @@ function FilePlayer(data) { video = $("