Estoy tratando de generar una miniatura de un video ( .mov ) pero muestra este error
error : error 4; detalles: DEMUXER_ERROR_NO_SUPPORTED_STREAMS: FFmpegDemuxer: no hay flujos compatibles
.mp4 y otros formatos funcionan bien.
versión de Chrome: versión 101.0.4951.67 (compilación oficial) (64 bits)
Código:
async generateVideoThumbnail(file) { console.log('generating thumbnail') const binaryData = [] binaryData.push(file) const canvas = document.createElement('canvas') const context = canvas.getContext('2d') const video = document.createElement('video') video.setAttribute('src', URL.createObjectURL(new Blob(binaryData))) video.onloadeddata = () => { console.log('Yay! The readyState just increased to ' + 'HAVE_CURRENT_DATA or greater for the first time.'); }; video.loadstart = () => { console.error(`load start`); } video.onwaiting = () => { console.log('Video is waiting for more data.'); }; video.onprogress = () => { console.log("Downloading video"); }; video.onerror = () => { console.log('video error') console.log("Error " + video.error.code + "; details: " + video.error.message); } console.log(video) console.log('video load') video.load() let thumbnail = await new Promise((resolve) => { video.onloadedmetadata = async () => { console.log('on load') canvas.width = video.videoWidth canvas.height = video.videoHeight video.currentTime = video.duration / 2 await video.play() context.drawImage(video, 0, 0) video.pause() const blob = await new Promise((resolve) => { return canvas.toBlob(function (blob) { resolve(blob) }) }) resolve(blob) } }) return thumbnail },No creo que Chrome pueda reproducir archivos mov. Puede verificar esto en la consola, escribiendo algo como:
const video = document.createElement('video') console.log(video.canPlayType('video/mp4')) //expect 'maybe' console.log(video.canPlayType('video/ogg')) //expect 'maybe' console.log(video.canPlayType('video/quicktime')) //expect ''Firefox, por otro lado, parece poder reproducirlos, puede probar su aplicación allí.