mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2026-09-03 03:50:02 +03:00
improve fullscreen behavior and address other review comments
This commit is contained in:
@@ -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) => {
|
||||
|
||||
Vendored
-6
@@ -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;
|
||||
|
||||
@@ -46,12 +46,10 @@ const BookOsd: FC<BookOsdProps> = ({
|
||||
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<BookOsdProps> = ({
|
||||
/>
|
||||
)}
|
||||
|
||||
<IconButton
|
||||
onClick={onClickFullscreen}
|
||||
icon={fullscreen ? 'fullscreen_exit' : 'fullscreen'}
|
||||
title={globalize.translate(fullscreen ? 'ExitFullscreen' : 'Fullscreen')}
|
||||
/>
|
||||
{(Screenfull.isEnabled || window.NativeShell) && (
|
||||
<IconButton
|
||||
onClick={onClickFullscreen}
|
||||
icon={fullscreen ? 'fullscreen_exit' : 'fullscreen'}
|
||||
title={globalize.translate(fullscreen ? 'ExitFullscreen' : 'Fullscreen')}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user