diff --git a/dashboard-ui/bower_components/emby-webcomponents/browserdeviceprofile.js b/dashboard-ui/bower_components/emby-webcomponents/browserdeviceprofile.js index 9674fca848..d86a58869c 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/browserdeviceprofile.js +++ b/dashboard-ui/bower_components/emby-webcomponents/browserdeviceprofile.js @@ -269,7 +269,7 @@ define(['browser'], function (browser) { } var mp3Added = false; - if (canPlayMkv || canPlayTs) { + if ((canPlayMkv && options.enableMkvProgressive !== false) || (canPlayTs && options.enableMkvProgressive !== false)) { if (supportsMp3VideoAudio) { mp3Added = true; videoAudioCodecs.push('mp3'); @@ -421,7 +421,8 @@ define(['browser'], function (browser) { AudioCodec: hlsVideoAudioCodecs.join(','), VideoCodec: 'h264', Context: 'Streaming', - Protocol: 'hls' + Protocol: 'hls', + MaxAudioChannels: physicalAudioChannels.toString() }); } diff --git a/dashboard-ui/scripts/htmlmediarenderer.js b/dashboard-ui/scripts/htmlmediarenderer.js index cdc4d4ea3f..754da83152 100644 --- a/dashboard-ui/scripts/htmlmediarenderer.js +++ b/dashboard-ui/scripts/htmlmediarenderer.js @@ -170,7 +170,7 @@ return elem; } - function enableHlsPlayer(src) { + function enableHlsPlayer(src, item, mediaSource) { if (src) { if (src.indexOf('.m3u8') == -1) { @@ -178,7 +178,25 @@ } } - return MediaPlayer.canPlayHls() && !MediaPlayer.canPlayNativeHls(); + if (MediaPlayer.canPlayHls()) { + + if (window.MediaSource == null) { + return false; + } + + if (MediaPlayer.canPlayNativeHls() && mediaSource.RunTimeTicks) { + return false; + } + + // For now don't do this in edge because we lose some native audio support + if (browser.edge) { + return false; + } + + return true; + } + + return false; } function getCrossOriginValue(mediaSource) { @@ -384,17 +402,19 @@ } subtitleTrackIndexToSetOnPlaying = currentTrackIndex; - if (enableHlsPlayer(val)) { + if (enableHlsPlayer(val, item, mediaSource)) { setTracks(elem, tracks); - var hls = new Hls(); - hls.loadSource(val); - hls.attachMedia(elem); - hls.on(Hls.Events.MANIFEST_PARSED, function () { - elem.play(); + requireHlsPlayer(function () { + var hls = new Hls(); + hls.loadSource(val); + hls.attachMedia(elem); + hls.on(Hls.Events.MANIFEST_PARSED, function () { + elem.play(); + }); + hlsPlayer = hls; }); - hlsPlayer = hls; } else { @@ -880,16 +900,7 @@ self.init = function () { - return new Promise(function (resolve, reject) { - - if (options.type == 'video' && enableHlsPlayer()) { - - requireHlsPlayer(resolve); - - } else { - resolve(); - } - }); + return Promise.resolve(); }; if (options.type == 'audio') { diff --git a/dashboard-ui/scripts/mediaplayer-video.js b/dashboard-ui/scripts/mediaplayer-video.js index 68dca771ea..dec583b6ad 100644 --- a/dashboard-ui/scripts/mediaplayer-video.js +++ b/dashboard-ui/scripts/mediaplayer-video.js @@ -1,4 +1,4 @@ -define(['appSettings', 'datetime', 'mediaInfo', 'scrollStyles', 'paper-icon-button-light'], function (appSettings, datetime, mediaInfo) { +define(['appSettings', 'datetime', 'mediaInfo', 'browser', 'scrollStyles', 'paper-icon-button-light'], function (appSettings, datetime, mediaInfo, browser) { function createVideoPlayer(self) { @@ -710,7 +710,7 @@ html += '
'; html += ''; - var hiddenOnIdleClass = AppInfo.isNativeApp && browserInfo.android ? 'hiddenOnIdle hide' : 'hiddenOnIdle'; + var hiddenOnIdleClass = AppInfo.isNativeApp && browser.android ? 'hiddenOnIdle hide' : 'hiddenOnIdle'; html += '