Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

113
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda