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