video-metadata-thumbnails
video-metadata-thumbnails copied to clipboard
Thumbnails not working with iOS
This seems to work great but will not work with iOS. I started working on a site for a company and they had this work around to just skip getting thumbnails for a video uploaded from any iOS device 2 years ago. Wondering if this has been fixed or what the reason is? I am not getting any errors at all but it seems to never resolve await getThumbnails if I comment out the if iPhone block. I can take that exact same video and upload it from a desktop computer(Windows or Mac) with zero issues. file is {"path":"filename.ext"}
export const getVideoThumbnail = async (file: any) => {
if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
//checkiPhone|iPad|iPod|iOS
console.log("getVideoThumbnail:IOS Device return null");
return null;
}
const thumbnails = await getThumbnails(file, {
quality: 1,
scale: 1,
} as IOption);
if (!_.isEmpty(thumbnails)) {
const firstBlob = thumbnails[0].blob;
if (firstBlob) {
const result = new File([firstBlob!!], `${uuidv4()}.png`, {
type: "image/png",
lastModified: Date.now(),
});
return result;
}
}
return null;
};