From 003b417073bafe2bbbe26d46413ca9cc69f9bbb9 Mon Sep 17 00:00:00 2001 From: dkanada Date: Sun, 26 Jul 2026 17:06:51 +0900 Subject: [PATCH] improve fullscreen behavior and address other review comments --- src/components/playback/playbackmanager.js | 4 +--- src/global.d.ts | 6 ------ src/plugins/bookPlayer/BookOsd/BookOsd.tsx | 16 ++++++++-------- src/plugins/comicsPlayer/plugin.js | 2 +- src/plugins/pdfPlayer/plugin.js | 7 ++++--- 5 files changed, 14 insertions(+), 21 deletions(-) diff --git a/src/components/playback/playbackmanager.js b/src/components/playback/playbackmanager.js index dd14e7e569..601dbb27f5 100644 --- a/src/components/playback/playbackmanager.js +++ b/src/components/playback/playbackmanager.js @@ -2266,9 +2266,7 @@ export class PlaybackManager { options.items = items; - return player.play(options).then(() => { - onPlaybackStarted(player, options, player.streamInfo, player.streamInfo?.mediaSource); - }); + return player.play(options); } const getAdditionalParts = async (items, mediaSourceId, startIndex) => { diff --git a/src/global.d.ts b/src/global.d.ts index 1f03a1a35c..83fce94a76 100644 --- a/src/global.d.ts +++ b/src/global.d.ts @@ -16,12 +16,6 @@ export declare global { 'viewshow': CustomEvent; } - interface Document { - webkitIsFullScreen?: boolean; - webkitCancelFullscreen?(): void; - webkitEnterFullscreen?(): void; - } - const __COMMIT_SHA__: string; const __JF_BUILD_VERSION__: string; const __PACKAGE_JSON_NAME__: string; diff --git a/src/plugins/bookPlayer/BookOsd/BookOsd.tsx b/src/plugins/bookPlayer/BookOsd/BookOsd.tsx index 8e55805741..79a9a2b20f 100644 --- a/src/plugins/bookPlayer/BookOsd/BookOsd.tsx +++ b/src/plugins/bookPlayer/BookOsd/BookOsd.tsx @@ -46,12 +46,10 @@ const BookOsd: FC = ({ const [fullscreen, setFullscreen] = useState(false); const updateFullscreen = useCallback((state: boolean) => { - if (Screenfull.isEnabled) { + if (Screenfull.isEnabled && Screenfull.isFullscreen !== state) { void Screenfull.toggle(); } else if (window.NativeShell) { state ? window.NativeShell.enableFullscreen() : window.NativeShell.disableFullscreen(); - } else if (document.webkitEnterFullscreen || document.webkitCancelFullscreen) { - state ? document.webkitEnterFullscreen?.() : document.webkitCancelFullscreen?.(); } }, []); @@ -135,11 +133,13 @@ const BookOsd: FC = ({ /> )} - + {(Screenfull.isEnabled || window.NativeShell) && ( + + )} ); diff --git a/src/plugins/comicsPlayer/plugin.js b/src/plugins/comicsPlayer/plugin.js index e113c6f986..2f3d503e5e 100644 --- a/src/plugins/comicsPlayer/plugin.js +++ b/src/plugins/comicsPlayer/plugin.js @@ -277,7 +277,7 @@ export class ComicsPlayer { this.pageCount = this.archiveSource.urls.length; this.currentPage = options.startPositionTicks / 10000 || 0; - this.currentSrc = () => this.currentPage; + this.currentSrc = () => downloadUrl; this.swiperInstance = new Swiper(elem.querySelector('.slideshowSwiperContainer'), { direction: 'horizontal', diff --git a/src/plugins/pdfPlayer/plugin.js b/src/plugins/pdfPlayer/plugin.js index ef13d6b97d..339098a19a 100644 --- a/src/plugins/pdfPlayer/plugin.js +++ b/src/plugins/pdfPlayer/plugin.js @@ -223,6 +223,7 @@ export class PdfPlayer { }); return downloadTask.promise.then(book => { if (this.cancellationToken) return; + this.currentSrc = () => downloadHref; this.book = book; this.loaded = true; @@ -267,7 +268,7 @@ export class PdfPlayer { // load any missing pages in the cache for (const page of pages) { - if (!this.pages[page] || this.dimensions !== window.innerWidth + window.innerHeight) { + if (!this.pages[page] || this.cacheWidth !== window.innerWidth || this.cacheHeight !== window.innerHeight) { this.pages[page] = document.createElement('canvas'); this.renderPage(this.pages[page], parseInt(page.slice(4), 10)); @@ -277,10 +278,10 @@ export class PdfPlayer { // show the requested page canvas?.parentNode.replaceChild(this.pages[prefix + number], canvas); - this.currentSrc = () => this.pages[prefix + number]; // track size so we can render all pages again when the screen has changed - this.dimensions = window.innerWidth + window.innerHeight; + this.cacheWidth = window.innerWidth; + this.cacheHeight = window.innerHeight; // delete all pages outside the cache area for (const page in this.pages) {