diff --git a/dashboard-ui/bower_components/emby-webcomponents/chromecastplayer.js b/dashboard-ui/bower_components/emby-webcomponents/chromecastplayer.js index 0ffc71db7c..003bce4014 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/chromecastplayer.js +++ b/dashboard-ui/bower_components/emby-webcomponents/chromecastplayer.js @@ -986,6 +986,15 @@ data = data || self.lastPlayerData; self.lastPlayerData = data; + if (data && data.NowPlayingItem) { + if (!data.NowPlayingItem.ImageTags || !data.NowPlayingItem.ImageTags.Primary) { + if (data.NowPlayingItem.PrimaryImageTag) { + data.NowPlayingItem.ImageTags = data.NowPlayingItem.ImageTags || {}; + data.NowPlayingItem.ImageTags.Primary = data.NowPlayingItem.PrimaryImageTag; + } + } + } + //console.log(JSON.stringify(data)); if (triggerStateChange) { diff --git a/dashboard-ui/scripts/nowplayingbar.js b/dashboard-ui/scripts/nowplayingbar.js index 9800c658df..1eb8ed8d60 100644 --- a/dashboard-ui/scripts/nowplayingbar.js +++ b/dashboard-ui/scripts/nowplayingbar.js @@ -490,6 +490,10 @@ function seriesImageUrl(item, options) { + if (!item) { + throw new Error('item cannot be null!'); + } + if (item.Type !== 'Episode') { return null; } @@ -528,6 +532,10 @@ function imageUrl(item, options) { + if (!item) { + throw new Error('item cannot be null!'); + } + options = options || {}; options.type = options.type || "Primary"; @@ -549,7 +557,9 @@ var currentImgUrl; function updateNowPlayingInfo(state) { - nowPlayingTextElement.innerHTML = nowPlayingHelper.getNowPlayingNames(state.NowPlayingItem).map(function (nowPlayingName) { + var nowPlayingItem = state.NowPlayingItem; + + nowPlayingTextElement.innerHTML = nowPlayingItem ? nowPlayingHelper.getNowPlayingNames(nowPlayingItem).map(function (nowPlayingName) { if (nowPlayingName.item) { return '
' + getTextActionButton(nowPlayingName.item, nowPlayingName.text) + '
'; @@ -557,18 +567,17 @@ return '
' + nowPlayingName.text + '
'; - }).join(''); + }).join('') : ''; var imgHeight = 70; - var nowPlayingItem = state.NowPlayingItem; - var url = seriesImageUrl(nowPlayingItem, { + var url = nowPlayingItem ? (seriesImageUrl(nowPlayingItem, { height: imgHeight }) || imageUrl(nowPlayingItem, { height: imgHeight - }); + })) : null; - if (url == currentImgUrl) { + if (url === currentImgUrl) { return; } diff --git a/dashboard-ui/scripts/site.js b/dashboard-ui/scripts/site.js index 10491ca813..78dc3c73ae 100644 --- a/dashboard-ui/scripts/site.js +++ b/dashboard-ui/scripts/site.js @@ -655,173 +655,6 @@ var Dashboard = { return new Promise(function (resolve, reject) { - function updateDeviceProfileForAndroid(profile) { - - // Just here as an easy escape out, if ever needed - var enableVlcVideo = true; - var enableVlcAudio = window.VlcAudio; - - if (enableVlcVideo) { - - profile.DirectPlayProfiles.push({ - Container: "m4v,3gp,ts,mpegts,mov,xvid,vob,mkv,wmv,asf,ogm,ogv,m2v,avi,mpg,mpeg,mp4,webm,wtv", - Type: 'Video', - AudioCodec: 'aac,aac_latm,mp2,mp3,ac3,wma,dca,dts,pcm,PCM_S16LE,PCM_S24LE,opus,flac' - }); - - profile.CodecProfiles = profile.CodecProfiles.filter(function (i) { - return i.Type == 'Audio'; - }); - - profile.SubtitleProfiles = []; - profile.SubtitleProfiles.push({ - Format: 'srt', - Method: 'External' - }); - profile.SubtitleProfiles.push({ - Format: 'ssa', - Method: 'External' - }); - profile.SubtitleProfiles.push({ - Format: 'ass', - Method: 'External' - }); - profile.SubtitleProfiles.push({ - Format: 'srt', - Method: 'Embed' - }); - profile.SubtitleProfiles.push({ - Format: 'subrip', - Method: 'Embed' - }); - profile.SubtitleProfiles.push({ - Format: 'ass', - Method: 'Embed' - }); - profile.SubtitleProfiles.push({ - Format: 'ssa', - Method: 'Embed' - }); - profile.SubtitleProfiles.push({ - Format: 'dvb_teletext', - Method: 'Embed' - }); - profile.SubtitleProfiles.push({ - Format: 'dvb_subtitle', - Method: 'Embed' - }); - profile.SubtitleProfiles.push({ - Format: 'dvbsub', - Method: 'Embed' - }); - profile.SubtitleProfiles.push({ - Format: 'pgs', - Method: 'Embed' - }); - profile.SubtitleProfiles.push({ - Format: 'pgssub', - Method: 'Embed' - }); - profile.SubtitleProfiles.push({ - Format: 'dvdsub', - Method: 'Embed' - }); - profile.SubtitleProfiles.push({ - Format: 'vtt', - Method: 'Embed' - }); - profile.SubtitleProfiles.push({ - Format: 'sub', - Method: 'Embed' - }); - profile.SubtitleProfiles.push({ - Format: 'idx', - Method: 'Embed' - }); - profile.SubtitleProfiles.push({ - Format: 'smi', - Method: 'Embed' - }); - - profile.CodecProfiles.push({ - Type: 'Video', - Container: 'avi', - Conditions: [ - { - Condition: 'NotEqual', - Property: 'CodecTag', - Value: 'xvid' - } - ] - }); - - profile.CodecProfiles.push({ - Type: 'Video', - Codec: 'h264', - Conditions: [ - { - Condition: 'EqualsAny', - Property: 'VideoProfile', - Value: 'high|main|baseline|constrained baseline' - }, - { - Condition: 'LessThanEqual', - Property: 'VideoLevel', - Value: '41' - }] - }); - - //profile.TranscodingProfiles.filter(function (p) { - - // return p.Type == 'Video' && p.Container == 'mkv'; - - //}).forEach(function (p) { - - // p.Container = 'ts'; - //}); - - profile.TranscodingProfiles.filter(function (p) { - - return p.Type == 'Video' && p.CopyTimestamps == true; - - }).forEach(function (p) { - - // Vlc doesn't seem to handle this well - p.CopyTimestamps = false; - }); - - profile.TranscodingProfiles.filter(function (p) { - - return p.Type == 'Video' && p.VideoCodec == 'h264'; - - }).forEach(function (p) { - - p.AudioCodec += ',ac3'; - }); - } - - if (enableVlcAudio) { - - profile.DirectPlayProfiles.push({ - Container: "aac,mp3,mpa,wav,wma,mp2,ogg,oga,webma,ape,opus,flac,m4a", - Type: 'Audio' - }); - - profile.CodecProfiles = profile.CodecProfiles.filter(function (i) { - return i.Type != 'Audio'; - }); - - profile.CodecProfiles.push({ - Type: 'Audio', - Conditions: [{ - Condition: 'LessThanEqual', - Property: 'AudioChannels', - Value: '2' - }] - }); - } - } - require(['browserdeviceprofile', 'qualityoptions', 'appSettings'], function (profileBuilder, qualityoptions, appSettings) { var profile = profileBuilder(Object.assign(profileOptions || {}, { @@ -847,10 +680,6 @@ var Dashboard = { })[0].maxHeight; } - if (AppInfo.isNativeApp && browserInfo.android) { - updateDeviceProfileForAndroid(profile); - } - profile.MaxStreamingBitrate = bitrateSetting; profile.MaxStaticMusicBitrate = appSettings.maxStaticMusicBitrate(); @@ -1628,11 +1457,6 @@ var AppInfo = {}; define("nativedirectorychooser", ["cordova/nativedirectorychooser"]); } - if (Dashboard.isRunningInCordova() && browserInfo.android) { - - window.VlcAudio = true; - } - if (Dashboard.isRunningInCordova() && browserInfo.android) { define("localsync", ["cordova/localsync"], returnFirstDependency); } @@ -2551,7 +2375,21 @@ var AppInfo = {}; //'plugins/playbackvalidation/plugin' ]; - if (Dashboard.isRunningInCordova() && browser.safari) { + if (Dashboard.isRunningInCordova() && browser.android) { + + // use the html audio player if flac is supported + if (document.createElement('audio').canPlayType('audio/flac').replace(/no/, '') && + document.createElement('audio').canPlayType('audio/ogg; codecs="opus"').replace(/no/, '')) { + + list.push('bower_components/emby-webcomponents/htmlaudioplayer/plugin'); + + } else { + + // use vlc player + list.push('cordova/vlcplayer'); + } + + } else if (Dashboard.isRunningInCordova() && browser.safari) { list.push('cordova/audioplayer'); } else { list.push('bower_components/emby-webcomponents/htmlaudioplayer/plugin'); diff --git a/dashboard-ui/scripts/videoosd.js b/dashboard-ui/scripts/videoosd.js index fe07b6582d..3275948f85 100644 --- a/dashboard-ui/scripts/videoosd.js +++ b/dashboard-ui/scripts/videoosd.js @@ -400,19 +400,32 @@ events.on(playbackManager, 'playerchange', onPlayerChange); bindToPlayer(playbackManager.getCurrentPlayer()); - document.addEventListener('mousemove', onMouseMove); + dom.addEventListener(document, 'mousemove', onMouseMove, { + passive: true + }); document.body.classList.add('autoScrollY'); showOsd(); inputManager.on(window, onInputCommand); + + dom.addEventListener(window, 'keydown', onWindowKeyDown, { + passive: true + }); }); view.addEventListener('viewbeforehide', function () { + + dom.removeEventListener(window, 'keydown', onWindowKeyDown, { + passive: true + }); + stopHideTimer(); getHeaderElement().classList.remove('osdHeader'); getHeaderElement().classList.remove('osdHeader-hidden'); - document.removeEventListener('mousemove', onMouseMove); + dom.removeEventListener(document, 'mousemove', onMouseMove, { + passive: true + }); document.body.classList.remove('autoScrollY'); inputManager.off(window, onInputCommand); @@ -904,15 +917,12 @@ getHeaderElement().classList.remove('hide'); }); - dom.addEventListener(window, 'keydown', function (e) { - + function onWindowKeyDown(e) { if (e.keyCode === 32 && !isOsdOpen()) { playbackManager.playPause(currentPlayer); showOsd(); } - }, { - passive: true - }); + } view.querySelector('.pageContainer').addEventListener('click', function () {