Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit b1ceccc

Browse files
authored
Fix thumbnail generation when offscreen canvas fails (#9272)
1 parent f67b8d0 commit b1ceccc

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/utils/image-media.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,8 @@ export async function createThumbnail(
9292
context.drawImage(element, 0, 0, targetWidth, targetHeight);
9393

9494
let thumbnailPromise: Promise<Blob>;
95-
96-
if (window.OffscreenCanvas) {
97-
thumbnailPromise = (canvas as OffscreenCanvas).convertToBlob({ type: mimeType });
95+
if (canvas instanceof window.OffscreenCanvas) {
96+
thumbnailPromise = canvas.convertToBlob({ type: mimeType });
9897
} else {
9998
thumbnailPromise = new Promise<Blob>(resolve => (canvas as HTMLCanvasElement).toBlob(resolve, mimeType));
10099
}

0 commit comments

Comments
 (0)