diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index f540f19cd..47013eab1 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -45,6 +45,7 @@ - [Camc314](https://github.com/camc314) - [danieladov](https://github.com/danieladov) - [Stephane Senart](https://github.com/ssenart) + - [imchasingshadows](https://github.com/imchasingshadows) - [Ömer Erdinç Yağmurlu](https://github.com/omeryagmurlu) - [Keegan Dahm](https://github.com/keegandahm) - [GodTamIt](https://github.com/GodTamIt) diff --git a/src/controllers/playback/video/index.js b/src/controllers/playback/video/index.js index 4443bfcaa..96bb5eeb3 100644 --- a/src/controllers/playback/video/index.js +++ b/src/controllers/playback/video/index.js @@ -410,6 +410,15 @@ import { appRouter } from '../../../components/appRouter'; } } + function onFullscreenChanged() { + if (currentPlayer.forcedFullscreen && !playbackManager.isFullscreen(currentPlayer)) { + appRouter.back(); + return; + } + + updateFullscreenIcon(); + } + function updateFullscreenIcon() { const button = view.querySelector('.btnFullscreen'); const icon = button.querySelector('.material-icons'); @@ -513,7 +522,7 @@ import { appRouter } from '../../../components/appRouter'; Events.on(player, 'pause', onPlayPauseStateChanged); Events.on(player, 'unpause', onPlayPauseStateChanged); Events.on(player, 'timeupdate', onTimeUpdate); - Events.on(player, 'fullscreenchange', updateFullscreenIcon); + Events.on(player, 'fullscreenchange', onFullscreenChanged); Events.on(player, 'mediastreamschange', onMediaStreamsChanged); Events.on(player, 'beginFetch', onBeginFetch); Events.on(player, 'endFetch', onEndFetch); @@ -537,7 +546,7 @@ import { appRouter } from '../../../components/appRouter'; Events.off(player, 'pause', onPlayPauseStateChanged); Events.off(player, 'unpause', onPlayPauseStateChanged); Events.off(player, 'timeupdate', onTimeUpdate); - Events.off(player, 'fullscreenchange', updateFullscreenIcon); + Events.off(player, 'fullscreenchange', onFullscreenChanged); Events.off(player, 'mediastreamschange', onMediaStreamsChanged); currentPlayer = null; } @@ -683,7 +692,7 @@ import { appRouter } from '../../../components/appRouter'; view.querySelector('.btnAirPlay').classList.remove('hide'); } - updateFullscreenIcon(); + onFullscreenChanged(); } function getDisplayPercentByTimeOfDay(programStartDateMs, programRuntimeMs, currentTimeMs) { diff --git a/src/plugins/htmlVideoPlayer/plugin.js b/src/plugins/htmlVideoPlayer/plugin.js index 2349b696a..611240be3 100644 --- a/src/plugins/htmlVideoPlayer/plugin.js +++ b/src/plugins/htmlVideoPlayer/plugin.js @@ -1361,24 +1361,41 @@ function tryRemoveElement(elem) { this.#videoDialog = dlg; this.#mediaElement = videoElement; + delete this.forcedFullscreen; + if (options.fullscreen) { // At this point, we must hide the scrollbar placeholder, so it's not being displayed while the item is being loaded document.body.classList.add('hide-scroll'); + + // Enter fullscreen in the webOS browser to hide the top bar + if (!window.NativeShell && browser.web0s && Screenfull.isEnabled) { + Screenfull.request().then(() => { + this.forcedFullscreen = true; + }); + return videoElement; + } + + // don't animate on smart tv's, too slow + if (!browser.slow && browser.supportsCssAnimation()) { + return zoomIn(dlg).then(function () { + return videoElement; + }); + } } - // don't animate on smart tv's, too slow - if (options.fullscreen && browser.supportsCssAnimation() && !browser.slow) { - return zoomIn(dlg).then(function () { - return videoElement; - }); - } else { - return videoElement; - } + return videoElement; }); } else { - // we need to hide scrollbar when starting playback from page with animated background if (options.fullscreen) { + // we need to hide scrollbar when starting playback from page with animated background document.body.classList.add('hide-scroll'); + + // Enter fullscreen in the webOS browser to hide the top bar + if (!this.forcedFullscreen && !window.NativeShell && browser.web0s && Screenfull.isEnabled) { + Screenfull.request().then(() => { + this.forcedFullscreen = true; + }); + } } return Promise.resolve(dlg.querySelector('video')); diff --git a/src/scripts/browser.js b/src/scripts/browser.js index fc0a5d443..672ef23fd 100644 --- a/src/scripts/browser.js +++ b/src/scripts/browser.js @@ -14,6 +14,20 @@ function isTv() { return true; } + if (isWeb0s()) { + return true; + } + + return false; +} + +function isWeb0s() { + const userAgent = navigator.userAgent.toLowerCase(); + + if (userAgent.indexOf('netcast') !== -1) { + return true; + } + if (userAgent.indexOf('web0s') !== -1) { return true; } @@ -234,7 +248,7 @@ if (userAgent.toLowerCase().indexOf('xbox') !== -1) { } browser.animate = typeof document !== 'undefined' && document.documentElement.animate != null; browser.tizen = userAgent.toLowerCase().indexOf('tizen') !== -1 || window.tizen != null; -browser.web0s = userAgent.toLowerCase().indexOf('Web0S'.toLowerCase()) !== -1; +browser.web0s = isWeb0s(); browser.edgeUwp = browser.edge && (userAgent.toLowerCase().indexOf('msapphost') !== -1 || userAgent.toLowerCase().indexOf('webview') !== -1); if (!browser.tizen) {