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

158
Vistas
How to stop MediaSource from loading all content automatically?

The code below works perfectly, but the video needs to be loaded all the way until it is produced, is there any way to load it partially?

const video = document.querySelector('video');
const assetURL = '/e_dashinit.mp4'; 
const mimeCodec = 'video/mp4; codecs="avc1.42E01E, mp4a.40.2"'; 
const mediaSource = new MediaSource(); 
video.src = URL.createObjectURL(mediaSource);
mediaSource.addEventListener('sourceopen', sourceOpen); 

function sourceOpen(_) {

    const mediaSource = this;
    const sourceBuffer = mediaSource.addSourceBuffer(mimeCodec); 
    fetchAB(assetURL, function (buf) {
        sourceBuffer.addEventListener('updateend', function (_) {
            mediaSource.endOfStream();
            video.play(); 
        });
        sourceBuffer.appendBuffer(buf);
    });
};

function fetchAB(url, cb) {
    const xhr = new XMLHttpRequest;
    xhr.open('get', url);
    xhr.responseType = 'arraybuffer';
    xhr.onload = function () {
        cb(xhr.response);
    };
    xhr.send();
};

return

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