From d96250df7ff9d472bfd3c300ecfcce0394c1ac59 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 14 Jan 2016 00:18:46 -0500 Subject: [PATCH] firefox hls fixes Conflicts: MediaBrowser.WebDashboard/dashboard-ui/bower_components/emby-webcomponents/.bower.json MediaBrowser.WebDashboard/dashboard-ui/bower_components/emby-webcomponents/browserdeviceprofile.js --- .../emby-webcomponents/.bower.json | 8 +-- .../emby-webcomponents/browser.js | 1 + .../browserdeviceprofile.js | 58 ++++++++----------- .../iron-behaviors/.bower.json | 6 +- .../bower_components/paper-input/.bower.json | 6 +- .../bower_components/polymer/.bower.json | 6 +- dashboard-ui/scripts/mediaplayer-video.js | 5 +- dashboard-ui/scripts/mediaplayer.js | 18 ++++-- 8 files changed, 55 insertions(+), 53 deletions(-) diff --git a/dashboard-ui/bower_components/emby-webcomponents/.bower.json b/dashboard-ui/bower_components/emby-webcomponents/.bower.json index 3fb667849b..5ff3c5d040 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/.bower.json +++ b/dashboard-ui/bower_components/emby-webcomponents/.bower.json @@ -15,12 +15,12 @@ }, "devDependencies": {}, "ignore": [], - "version": "1.0.14", - "_release": "1.0.14", + "version": "1.0.18", + "_release": "1.0.18", "_resolution": { "type": "version", - "tag": "1.0.14", - "commit": "a7a8baf260ab509c5f9b1750cbf6fe921883141c" + "tag": "1.0.18", + "commit": "a251227c4635bcac732075e494b2d8a4e7956d26" }, "_source": "git://github.com/MediaBrowser/emby-webcomponents.git", "_target": "~1.0.0", diff --git a/dashboard-ui/bower_components/emby-webcomponents/browser.js b/dashboard-ui/bower_components/emby-webcomponents/browser.js index cc4cef38d2..3194e5e182 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/browser.js +++ b/dashboard-ui/bower_components/emby-webcomponents/browser.js @@ -8,6 +8,7 @@ /(opr)(?:.*version|)[ \/]([\w.]+)/.exec(ua) || /(chrome)[ \/]([\w.]+)/.exec(ua) || /(safari)[ \/]([\w.]+)/.exec(ua) || + /(firefox)[ \/]([\w.]+)/.exec(ua) || /(msie) ([\w.]+)/.exec(ua) || ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || []; diff --git a/dashboard-ui/bower_components/emby-webcomponents/browserdeviceprofile.js b/dashboard-ui/bower_components/emby-webcomponents/browserdeviceprofile.js index a7b6658b30..aeaf71132d 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/browserdeviceprofile.js +++ b/dashboard-ui/bower_components/emby-webcomponents/browserdeviceprofile.js @@ -29,7 +29,7 @@ list.push('h264'); } - if (document.createElement('audio').canPlayType('audio/aac').replace(/no/, '')) { + if (document.createElement('audio').canPlayType('audio/aac').replace(/no/, '') || browser.firefox) { list.push('aac'); } @@ -103,12 +103,33 @@ profile.DirectPlayProfiles = []; + var videoAudioCodecs = []; + + // Only put mp3 first if mkv support is there + // Otherwise with HLS and mp3 audio we're seeing some browsers + if (canPlayMkv) { + if (canPlayMp3) { + videoAudioCodecs.push('mp3'); + } + } + if (canPlayAac) { + videoAudioCodecs.push('aac'); + } + if (!canPlayMkv) { + if (canPlayMp3) { + videoAudioCodecs.push('mp3'); + } + } + if (canPlayAc3) { + videoAudioCodecs.push('ac3'); + } + if (supportedFormats.indexOf('h264') != -1) { profile.DirectPlayProfiles.push({ Container: 'mp4,m4v', Type: 'Video', VideoCodec: 'h264', - AudioCodec: 'aac' + (canPlayMp3 ? ',mp3' : '') + (canPlayAc3 ? ',ac3' : '') + AudioCodec: videoAudioCodecs.join(',') }); } @@ -117,7 +138,7 @@ Container: 'mkv,mov', Type: 'Video', VideoCodec: 'h264', - AudioCodec: 'aac' + (canPlayMp3 ? ',mp3' : '') + (canPlayAc3 ? ',ac3' : '') + AudioCodec: videoAudioCodecs.join(',') }); } @@ -160,17 +181,6 @@ } }); - var videoAudioCodecs = []; - if (canPlayMp3) { - videoAudioCodecs.push('mp3'); - } - if (canPlayAac) { - videoAudioCodecs.push('aac'); - } - if (canPlayAc3) { - videoAudioCodecs.push('ac3'); - } - // Can't use mkv on mobile because we have to use the native player controls and they won't be able to seek it if (canPlayMkv && !browser.mobile) { profile.TranscodingProfiles.push({ @@ -235,7 +245,7 @@ }] }); - var videoAudioChannels = browser.safari ? '2' : '6'; + var videoAudioChannels = '6'; profile.CodecProfiles.push({ Type: 'VideoAudio', @@ -268,24 +278,6 @@ ] }); - profile.CodecProfiles.push({ - Type: 'VideoAudio', - Codec: 'aac,mp3', - Conditions: [ - { - Condition: 'LessThanEqual', - Property: 'AudioChannels', - Value: videoAudioChannels - }, - { - Condition: 'Equals', - Property: 'IsSecondaryAudio', - Value: 'false', - IsRequired: 'false' - } - ] - }); - profile.CodecProfiles.push({ Type: 'VideoAudio', Conditions: [ diff --git a/dashboard-ui/bower_components/iron-behaviors/.bower.json b/dashboard-ui/bower_components/iron-behaviors/.bower.json index db08f2170c..17f68b3351 100644 --- a/dashboard-ui/bower_components/iron-behaviors/.bower.json +++ b/dashboard-ui/bower_components/iron-behaviors/.bower.json @@ -29,14 +29,14 @@ "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" }, "ignore": [], - "homepage": "https://github.com/PolymerElements/iron-behaviors", + "homepage": "https://github.com/polymerelements/iron-behaviors", "_release": "1.0.12", "_resolution": { "type": "version", "tag": "v1.0.12", "commit": "657f526a2382a659cdf4e13be87ecc89261588a3" }, - "_source": "git://github.com/PolymerElements/iron-behaviors.git", + "_source": "git://github.com/polymerelements/iron-behaviors.git", "_target": "^1.0.0", - "_originalSource": "PolymerElements/iron-behaviors" + "_originalSource": "polymerelements/iron-behaviors" } \ No newline at end of file diff --git a/dashboard-ui/bower_components/paper-input/.bower.json b/dashboard-ui/bower_components/paper-input/.bower.json index b59e0b67c3..8d106232c1 100644 --- a/dashboard-ui/bower_components/paper-input/.bower.json +++ b/dashboard-ui/bower_components/paper-input/.bower.json @@ -52,7 +52,7 @@ "tag": "v1.1.3", "commit": "f070288446f9e78fbe16b032ddb429a8e8015ee7" }, - "_source": "git://github.com/PolymerElements/paper-input.git", - "_target": "^1.0.0", - "_originalSource": "PolymerElements/paper-input" + "_source": "git://github.com/polymerelements/paper-input.git", + "_target": "^1.0.9", + "_originalSource": "polymerelements/paper-input" } \ No newline at end of file diff --git a/dashboard-ui/bower_components/polymer/.bower.json b/dashboard-ui/bower_components/polymer/.bower.json index 6cb5d92767..b3a07a70af 100644 --- a/dashboard-ui/bower_components/polymer/.bower.json +++ b/dashboard-ui/bower_components/polymer/.bower.json @@ -24,14 +24,14 @@ "web-component-tester": "*" }, "private": true, - "homepage": "https://github.com/Polymer/polymer", + "homepage": "https://github.com/polymer/polymer", "_release": "1.2.3", "_resolution": { "type": "version", "tag": "v1.2.3", "commit": "aa535d1675342007cbf64dc9c66497cf74cbc616" }, - "_source": "git://github.com/Polymer/polymer.git", + "_source": "git://github.com/polymer/polymer.git", "_target": "^1.0.0", - "_originalSource": "Polymer/polymer" + "_originalSource": "polymer/polymer" } \ No newline at end of file diff --git a/dashboard-ui/scripts/mediaplayer-video.js b/dashboard-ui/scripts/mediaplayer-video.js index 327e4858fc..e551d7670c 100644 --- a/dashboard-ui/scripts/mediaplayer-video.js +++ b/dashboard-ui/scripts/mediaplayer-video.js @@ -967,9 +967,12 @@ self.createStreamInfo('Video', item, mediaSource, startPosition).then(function (streamInfo) { + var isHls = streamInfo.url.toLowerCase().indexOf('.m3u8') != -1; + // Huge hack alert. Safari doesn't seem to like if the segments aren't available right away when playback starts // This will start the transcoding process before actually feeding the video url into the player - if (browserInfo.safari && !mediaSource.RunTimeTicks) { + // Edit: Also seeing stalls from hls.js + if ((browserInfo.safari || browserInfo.msie || browserInfo.firefox) && !mediaSource.RunTimeTicks && isHls) { Dashboard.showLoadingMsg(); var hlsPlaylistUrl = streamInfo.url.replace('master.m3u8', 'live.m3u8'); diff --git a/dashboard-ui/scripts/mediaplayer.js b/dashboard-ui/scripts/mediaplayer.js index 832b90bccc..03824619e3 100644 --- a/dashboard-ui/scripts/mediaplayer.js +++ b/dashboard-ui/scripts/mediaplayer.js @@ -77,15 +77,20 @@ profile.DirectPlayProfiles = []; var videoAudioCodecs = []; - // Putting mp3 first is really just a hack to ensure we transcode to 2 channels - if (canPlayMp3) { - videoAudioCodecs.push('mp3'); + // Only put mp3 first if mkv support is there + // Otherwise with HLS and mp3 audio we're seeing firefox and chrome not play it with HLS + if (canPlayMkv) { + if (canPlayMp3) { + videoAudioCodecs.push('mp3'); + } } if (canPlayAac) { videoAudioCodecs.push('aac'); } - if (canPlayAc3) { - videoAudioCodecs.push('ac3'); + if (!canPlayMkv) { + if (canPlayMp3) { + videoAudioCodecs.push('mp3'); + } } if (supportedFormats.indexOf('h264') != -1) { @@ -1826,7 +1831,8 @@ list.push('h264'); } - if (document.createElement('audio').canPlayType('audio/aac').replace(/no/, '')) { + // Firefox always reports that it doesn't support aac, so assume that it does + if (document.createElement('audio').canPlayType('audio/aac').replace(/no/, '') || browserInfo.firefox) { list.push('aac'); } if (document.createElement('audio').canPlayType('audio/mp3').replace(/no/, '')) {