parent
77f3b81e21
commit
0fa01fcc33
1 changed files with 2 additions and 0 deletions
|
|
@ -150,6 +150,7 @@ export class AttachmentManager {
|
||||||
canvas.width = 640;
|
canvas.width = 640;
|
||||||
canvas.height = 480;
|
canvas.height = 480;
|
||||||
let video: HTMLVideoElement = document.createElement("video");
|
let video: HTMLVideoElement = document.createElement("video");
|
||||||
|
video.preload = "auto";
|
||||||
video.addEventListener("loadedmetadata", function () {
|
video.addEventListener("loadedmetadata", function () {
|
||||||
if (video.videoWidth > THUMBNAIL_MAX_WIDTH || video.videoHeight > THUMBNAIL_MAX_HEIGHT) {
|
if (video.videoWidth > THUMBNAIL_MAX_WIDTH || video.videoHeight > THUMBNAIL_MAX_HEIGHT) {
|
||||||
var aspect = video.videoWidth / video.videoHeight;
|
var aspect = video.videoWidth / video.videoHeight;
|
||||||
|
|
@ -183,6 +184,7 @@ export class AttachmentManager {
|
||||||
});
|
});
|
||||||
video.src = url;
|
video.src = url;
|
||||||
video.currentTime = 0.1;
|
video.currentTime = 0.1;
|
||||||
|
video.load();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Failed to get video thumbnail: " + error);
|
console.error("Failed to get video thumbnail: " + error);
|
||||||
resolve(undefined);
|
resolve(undefined);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue