Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

104
Vistas
How to seek video when playing from MediaSource

I followed this guide: https://github.com/nickdesaulniers/netfix/blob/gh-pages/demo/bufferWhenNeeded.html

When the user selects a play point on the progress bar.

will call seek() to return the corresponding data then append the data to sourceBuffer,

    function seek(e) {
        const start = (Math.round((totalFileSize / video.duration) * video.currentTime));
        const end = (start + Math.round(start / 5));
        fetchRange(assetURL, start, end);
    };

    function fetchRange(url, start, end) {
        var xhr = new XMLHttpRequest;
        xhr.open('get', url);
        xhr.responseType = 'arraybuffer';
        xhr.setRequestHeader('Range', 'bytes=' + start + '-' + end);
        xhr.onload = function () {
            console.log('fetched bytes: ', start, end);
            bytesFetched += end - start + 1;
            sourceBuffer.appendBuffer(chunk);
        };
        xhr.send();
    };

however i always get an error:

"Failed to execute 'appendBuffer' on 'SourceBuffer': The HTMLMediaElement.error attribute is not null."

I really searched a lot but couldn't solve it,

I'm really grateful someone can help.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda