mirror of
https://github.com/kmc7468/arkvault.git
synced 2025-12-15 22:38:47 +00:00
비디오 재생이 지원되지 않는 포맷일 때 썸네일 생성 작업이 무한히 끝나지 않던 버그 수정
This commit is contained in:
@@ -67,10 +67,15 @@ const generateVideoThumbnail = (videoUrl: string, time = 0) => {
|
|||||||
return new Promise<Blob>((resolve, reject) => {
|
return new Promise<Blob>((resolve, reject) => {
|
||||||
const video = document.createElement("video");
|
const video = document.createElement("video");
|
||||||
video.onloadedmetadata = () => {
|
video.onloadedmetadata = () => {
|
||||||
video.currentTime = Math.min(time, video.duration);
|
if (video.videoWidth === 0 || video.videoHeight === 0) {
|
||||||
video.requestVideoFrameCallback(() => {
|
return reject();
|
||||||
|
}
|
||||||
|
|
||||||
|
const callbackId = video.requestVideoFrameCallback(() => {
|
||||||
captureVideoThumbnail(video).then(resolve).catch(reject);
|
captureVideoThumbnail(video).then(resolve).catch(reject);
|
||||||
|
video.cancelVideoFrameCallback(callbackId);
|
||||||
});
|
});
|
||||||
|
video.currentTime = Math.min(time, video.duration);
|
||||||
};
|
};
|
||||||
video.onerror = reject;
|
video.onerror = reject;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user