mirror of
https://github.com/element-hq/element-web
synced 2024-11-27 03:36:07 +03:00
Fix thumbnail generation when offscreen canvas fails (#9272)
This commit is contained in:
parent
f67b8d0d32
commit
b1cecccb57
1 changed files with 2 additions and 3 deletions
|
@ -92,9 +92,8 @@ export async function createThumbnail(
|
|||
context.drawImage(element, 0, 0, targetWidth, targetHeight);
|
||||
|
||||
let thumbnailPromise: Promise<Blob>;
|
||||
|
||||
if (window.OffscreenCanvas) {
|
||||
thumbnailPromise = (canvas as OffscreenCanvas).convertToBlob({ type: mimeType });
|
||||
if (canvas instanceof window.OffscreenCanvas) {
|
||||
thumbnailPromise = canvas.convertToBlob({ type: mimeType });
|
||||
} else {
|
||||
thumbnailPromise = new Promise<Blob>(resolve => (canvas as HTMLCanvasElement).toBlob(resolve, mimeType));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue