Originalmente recibí el siguiente error en un código para un reproductor de video: Uncaught (in promise) DOMException: The fetching process for the media resource was aborted by the user agent at the user's request
, así que busqué una solución y me encontré con esto artículo Luego reemplacé todas las funciones de reproducción y pausa con la solución detallada en el artículo, pero no resolvió el error. ¿Implementé la solución incorrectamente? Cualquier orientación sería muy apreciada, gracias!
function pauseVideo( idx, div, img, playPromise ) { img = getVideoElm( idx, div, img ); if( !img ) return; else var playPromise = img.play(); if (playPromise !== undefined) { playPromise.then(_ => { if( img.paused ) addClass( img, 'video-paused'); else removeClass( img, 'video-paused'); img.pause(); }) .catch(error => { console.log("playPromise is undefined"); }); } else console.log("Video failed to pause"); } function resumeVideo( idx, div, img, forcePause, playPromise ) { img = getVideoElm( idx, div, img ); var playPromise = img.play(); if( !img ) return; else if( forcePause || hasClass(img, 'video-paused') ) img.pause(); else if (playPromise !== undefined) { playPromise.then(_ => { }) .catch(error => { console.log("playPromise is undefined"); }); } else console.log("Video failed to load"); }