diff --git a/dashboard-ui/apiclient/apiclient.js b/dashboard-ui/apiclient/apiclient.js index 7c4c7e94de..0ef3049e5a 100644 --- a/dashboard-ui/apiclient/apiclient.js +++ b/dashboard-ui/apiclient/apiclient.js @@ -211,6 +211,9 @@ function tryReconnectInternal(deferred, connectionMode, currentRetryCount) { + var previousConnectionMode = self.serverInfo().LastConnectionMode; + var previousServerAddress = MediaBrowser.ServerInfo.getServerAddress(self.serverInfo(), previousConnectionMode); + connectionMode = switchConnectionMode(connectionMode); var url = MediaBrowser.ServerInfo.getServerAddress(self.serverInfo(), connectionMode); @@ -228,7 +231,7 @@ }).done(function () { - logger.log("Reconnect succeeeded to " + url); + logger.log("Reconnect succeeded to " + url); self.serverInfo().LastConnectionMode = connectionMode; self.serverAddress(url); @@ -262,25 +265,11 @@ return deferred.promise(); } - function replaceServerAddress(url, oldBaseUrl, newBaseUrl) { - - return url.replace(oldBaseUrl, newBaseUrl); - } - self.ajaxWithFailover = function (request, deferred, enableReconnection, replaceUrl) { - if (replaceUrl) { - - var currentServerInfo = self.serverInfo(); - - var baseUrl = MediaBrowser.ServerInfo.getServerAddress(currentServerInfo, currentServerInfo.LastConnectionMode); - - request.url = replaceServerAddress(request.url, baseUrl); - } - logger.log("Requesting " + request.url); - request.timeout = 15000; + request.timeout = 30000; HttpClient.send(request).done(function (response) { @@ -301,6 +290,8 @@ tryReconnect().done(function () { logger.log("Reconnect succeesed"); + request.url = request.url.replace("dddd", MediaBrowser.ServerInfo.getServerAddress(self.serverInfo(), self.serverInfo().LastConnectionMode)); + self.ajaxWithFailover(request, deferred, false, true); }).fail(function () { diff --git a/dashboard-ui/cordova/chromecast.js b/dashboard-ui/cordova/chromecast.js index 1ddde4edbd..00f1fd7545 100644 --- a/dashboard-ui/cordova/chromecast.js +++ b/dashboard-ui/cordova/chromecast.js @@ -25,13 +25,6 @@ var castPlayer = {}; - $(castPlayer).on("connect", function (e) { - - Logger.log('cc: connect'); - // Reset this so the next query doesn't make it appear like content is playing. - self.lastPlayerData = {}; - }); - $(castPlayer).on("playbackstart", function (e, data) { Logger.log('cc: playbackstart'); @@ -461,10 +454,12 @@ } function handleSessionDisconnect() { + Logger.log("session disconnected"); - cleanupSession(); - MediaController.removeActivePlayer(PlayerName); + // We can't trust this because we might receive events of other devices disconnecting + //cleanupSession(); + //MediaController.removeActivePlayer(PlayerName); } function onWebAppSessionConnect(webAppSession, device) { @@ -476,10 +471,9 @@ currentDevice = device; currentDeviceId = device.getId(); + self.lastPlayerData = {}; MediaController.setActivePlayer(PlayerName, convertDeviceToTarget(device)); - $(castPlayer).trigger('connect'); - sendIdentifyMessage(); } @@ -528,6 +522,7 @@ session.release(); } + self.lastPlayerData = {}; currentWebAppSession = null; } @@ -592,6 +587,7 @@ device.off("ready"); Logger.log('creating webAppSession'); + self.lastPlayerData = {}; launchWebApp(device); } @@ -653,6 +649,7 @@ cleanupSession(); currentDevice = null; currentDeviceId = null; + self.lastPlayerData = {}; } } }); diff --git a/dashboard-ui/css/mediaplayer-video.css b/dashboard-ui/css/mediaplayer-video.css index 1d11bd09d0..d255a0d87f 100644 --- a/dashboard-ui/css/mediaplayer-video.css +++ b/dashboard-ui/css/mediaplayer-video.css @@ -18,6 +18,7 @@ right: 0; bottom: 0; background-color: #222; + color: #fff; } .itemVideo { @@ -69,7 +70,7 @@ .nowPlayingInfo { text-align: center; - padding: 1em 1em 2em 1em; + padding: 1.5em 1em 2em 1em; } #videoPlayer .nowPlayingImage img { diff --git a/dashboard-ui/css/site.css b/dashboard-ui/css/site.css index b8e296a865..93ff8a0dcf 100644 --- a/dashboard-ui/css/site.css +++ b/dashboard-ui/css/site.css @@ -311,7 +311,7 @@ html { } body { - overflow-y: scroll !important; + overflow-y: auto !important; /* This is needed to prevent a horizontal scrollbar while neon-animated-pages are animating. */ overflow-x: hidden; font-size: 13px; diff --git a/dashboard-ui/scripts/htmlmediarenderer.js b/dashboard-ui/scripts/htmlmediarenderer.js index 84ba1e96f6..404c2c66e8 100644 --- a/dashboard-ui/scripts/htmlmediarenderer.js +++ b/dashboard-ui/scripts/htmlmediarenderer.js @@ -61,15 +61,15 @@ function onOneVideoPlaying() { - var requiresNativeControls = !MediaPlayer.enableCustomVideoControls(); + var requiresNativeControls = !self.enableCustomVideoControls(); if (requiresNativeControls) { $(this).attr('controls', 'controls'); } - var currentSrc = (this.currentSrc || '').toLowerCase(); + var src = (self.currentSrc() || '').toLowerCase(); - var parts = currentSrc.split('#'); + var parts = src.split('#'); if (parts.length > 1) { @@ -80,7 +80,7 @@ var startPositionInSeekParam = parseFloat(parts[1]); // Appending #t=xxx to the query string doesn't seem to work with HLS - if (startPositionInSeekParam && currentSrc.indexOf('.m3u8') != -1) { + if (startPositionInSeekParam && src.indexOf('.m3u8') != -1) { var element = this; setTimeout(function () { element.currentTime = startPositionInSeekParam; @@ -124,11 +124,35 @@ .on('error', onError)[0]; } + function enableViblast() { + + return MediaPlayer.canPlayHls() && !MediaPlayer.canPlayNativeHls(); + } + function createVideoElement() { - var elem = $('.itemVideo'); + var html = ''; - return elem + var requiresNativeControls = !self.enableCustomVideoControls(); + + // Can't autoplay in these browsers so we need to use the full controls + if (requiresNativeControls && AppInfo.isNativeApp && $.browser.android) { + html += '