Merge pull request #2781 from imchasingshadows/bugfix/web0s-fullscreen
bugfix/web0s-fullscreen
This commit is contained in:
commit
33e7ac96b2
4 changed files with 54 additions and 13 deletions
|
@ -45,6 +45,7 @@
|
||||||
- [Camc314](https://github.com/camc314)
|
- [Camc314](https://github.com/camc314)
|
||||||
- [danieladov](https://github.com/danieladov)
|
- [danieladov](https://github.com/danieladov)
|
||||||
- [Stephane Senart](https://github.com/ssenart)
|
- [Stephane Senart](https://github.com/ssenart)
|
||||||
|
- [imchasingshadows](https://github.com/imchasingshadows)
|
||||||
- [Ömer Erdinç Yağmurlu](https://github.com/omeryagmurlu)
|
- [Ömer Erdinç Yağmurlu](https://github.com/omeryagmurlu)
|
||||||
- [Keegan Dahm](https://github.com/keegandahm)
|
- [Keegan Dahm](https://github.com/keegandahm)
|
||||||
- [GodTamIt](https://github.com/GodTamIt)
|
- [GodTamIt](https://github.com/GodTamIt)
|
||||||
|
|
|
@ -410,6 +410,15 @@ import { appRouter } from '../../../components/appRouter';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onFullscreenChanged() {
|
||||||
|
if (currentPlayer.forcedFullscreen && !playbackManager.isFullscreen(currentPlayer)) {
|
||||||
|
appRouter.back();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
updateFullscreenIcon();
|
||||||
|
}
|
||||||
|
|
||||||
function updateFullscreenIcon() {
|
function updateFullscreenIcon() {
|
||||||
const button = view.querySelector('.btnFullscreen');
|
const button = view.querySelector('.btnFullscreen');
|
||||||
const icon = button.querySelector('.material-icons');
|
const icon = button.querySelector('.material-icons');
|
||||||
|
@ -513,7 +522,7 @@ import { appRouter } from '../../../components/appRouter';
|
||||||
Events.on(player, 'pause', onPlayPauseStateChanged);
|
Events.on(player, 'pause', onPlayPauseStateChanged);
|
||||||
Events.on(player, 'unpause', onPlayPauseStateChanged);
|
Events.on(player, 'unpause', onPlayPauseStateChanged);
|
||||||
Events.on(player, 'timeupdate', onTimeUpdate);
|
Events.on(player, 'timeupdate', onTimeUpdate);
|
||||||
Events.on(player, 'fullscreenchange', updateFullscreenIcon);
|
Events.on(player, 'fullscreenchange', onFullscreenChanged);
|
||||||
Events.on(player, 'mediastreamschange', onMediaStreamsChanged);
|
Events.on(player, 'mediastreamschange', onMediaStreamsChanged);
|
||||||
Events.on(player, 'beginFetch', onBeginFetch);
|
Events.on(player, 'beginFetch', onBeginFetch);
|
||||||
Events.on(player, 'endFetch', onEndFetch);
|
Events.on(player, 'endFetch', onEndFetch);
|
||||||
|
@ -537,7 +546,7 @@ import { appRouter } from '../../../components/appRouter';
|
||||||
Events.off(player, 'pause', onPlayPauseStateChanged);
|
Events.off(player, 'pause', onPlayPauseStateChanged);
|
||||||
Events.off(player, 'unpause', onPlayPauseStateChanged);
|
Events.off(player, 'unpause', onPlayPauseStateChanged);
|
||||||
Events.off(player, 'timeupdate', onTimeUpdate);
|
Events.off(player, 'timeupdate', onTimeUpdate);
|
||||||
Events.off(player, 'fullscreenchange', updateFullscreenIcon);
|
Events.off(player, 'fullscreenchange', onFullscreenChanged);
|
||||||
Events.off(player, 'mediastreamschange', onMediaStreamsChanged);
|
Events.off(player, 'mediastreamschange', onMediaStreamsChanged);
|
||||||
currentPlayer = null;
|
currentPlayer = null;
|
||||||
}
|
}
|
||||||
|
@ -683,7 +692,7 @@ import { appRouter } from '../../../components/appRouter';
|
||||||
view.querySelector('.btnAirPlay').classList.remove('hide');
|
view.querySelector('.btnAirPlay').classList.remove('hide');
|
||||||
}
|
}
|
||||||
|
|
||||||
updateFullscreenIcon();
|
onFullscreenChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDisplayPercentByTimeOfDay(programStartDateMs, programRuntimeMs, currentTimeMs) {
|
function getDisplayPercentByTimeOfDay(programStartDateMs, programRuntimeMs, currentTimeMs) {
|
||||||
|
|
|
@ -1361,24 +1361,41 @@ function tryRemoveElement(elem) {
|
||||||
this.#videoDialog = dlg;
|
this.#videoDialog = dlg;
|
||||||
this.#mediaElement = videoElement;
|
this.#mediaElement = videoElement;
|
||||||
|
|
||||||
|
delete this.forcedFullscreen;
|
||||||
|
|
||||||
if (options.fullscreen) {
|
if (options.fullscreen) {
|
||||||
// At this point, we must hide the scrollbar placeholder, so it's not being displayed while the item is being loaded
|
// 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');
|
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
|
// don't animate on smart tv's, too slow
|
||||||
if (options.fullscreen && browser.supportsCssAnimation() && !browser.slow) {
|
if (!browser.slow && browser.supportsCssAnimation()) {
|
||||||
return zoomIn(dlg).then(function () {
|
return zoomIn(dlg).then(function () {
|
||||||
return videoElement;
|
return videoElement;
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
return videoElement;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return videoElement;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// we need to hide scrollbar when starting playback from page with animated background
|
|
||||||
if (options.fullscreen) {
|
if (options.fullscreen) {
|
||||||
|
// we need to hide scrollbar when starting playback from page with animated background
|
||||||
document.body.classList.add('hide-scroll');
|
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'));
|
return Promise.resolve(dlg.querySelector('video'));
|
||||||
|
|
|
@ -14,6 +14,20 @@ function isTv() {
|
||||||
return true;
|
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) {
|
if (userAgent.indexOf('web0s') !== -1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -234,7 +248,7 @@ if (userAgent.toLowerCase().indexOf('xbox') !== -1) {
|
||||||
}
|
}
|
||||||
browser.animate = typeof document !== 'undefined' && document.documentElement.animate != null;
|
browser.animate = typeof document !== 'undefined' && document.documentElement.animate != null;
|
||||||
browser.tizen = userAgent.toLowerCase().indexOf('tizen') !== -1 || window.tizen != 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);
|
browser.edgeUwp = browser.edge && (userAgent.toLowerCase().indexOf('msapphost') !== -1 || userAgent.toLowerCase().indexOf('webview') !== -1);
|
||||||
|
|
||||||
if (!browser.tizen) {
|
if (!browser.tizen) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue