Make sure video thumb generation works on iOS

Issue #674
This commit is contained in:
N-Pex 2025-09-02 10:39:44 +02:00
parent 77f3b81e21
commit 0fa01fcc33

View file

@ -150,6 +150,7 @@ export class AttachmentManager {
canvas.width = 640;
canvas.height = 480;
let video: HTMLVideoElement = document.createElement("video");
video.preload = "auto";
video.addEventListener("loadedmetadata", function () {
if (video.videoWidth > THUMBNAIL_MAX_WIDTH || video.videoHeight > THUMBNAIL_MAX_HEIGHT) {
var aspect = video.videoWidth / video.videoHeight;
@ -183,6 +184,7 @@ export class AttachmentManager {
});
video.src = url;
video.currentTime = 0.1;
video.load();
} catch (error) {
console.error("Failed to get video thumbnail: " + error);
resolve(undefined);