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

230
Vistas
¿Cómo escribir el cargador hls.js?

Estoy tratando de crear un nuevo cargador para fragmentos hls.js, pero no funciona.

Hizo todo por su doc ( https://github.com/video-dev/hls.js/blob/master/docs/API.md#loader ).

¿Por qué no funciona?

 const Loader = class { start = Date.now(); stats: LoadStats = { aborted: false, loaded: 0, retry: 0, total: 0, chunkCount: 0, bwEstimate: 0, loading: { start: this.start, first: 0, end: 0 }, parsing: { start: this.start, end: 0 }, buffering: { start: this.start, first: 0, end: 0 }, }; // @ts-ignore load = async (context, config, callbacks) => { const request = new XMLHttpRequest(); request.open('GET', context.url, true); request.responseType = context.responseType; request.onprogress = (event: ProgressEvent) => { const now = Date.now(); this.stats.loaded = event.loaded; this.stats.total = event.total; this.stats.chunkCount += 1; this.stats.bwEstimate = this.stats.loaded / (now - this.start); if (this.stats.loading.first === 0) { this.stats.loading.first = now; this.stats.buffering.first = now; } // There is no ArrayBuffer in response, XHR does not support that callbacks.onProgress(this.stats, context, new ArrayBuffer(0)); }; request.onabort = () => { this.stats.aborted = true; callbacks.onError( { code: 0, text: 'Error while loading of the fragment', }, context, request ); }; request.onreadystatechange = () => { if (request.readyState !== 4) { return; } const now = Date.now(); this.stats.loaded = request.response.byteLength; this.stats.total = request.response.byteLength; this.stats.loading.end = now; this.stats.parsing.end = now; this.stats.buffering.end = now; callbacks.onSuccess( { url: request.responseURL, data: request.response, }, this.stats, context, request ); }; request.send(); }; /** Abort any loading in progress. */ abort = function (): void {}; /** Destroy loading context. */ destroy = function (): void {}; };

Log tiene algo extraño: hls.js carga todos los segmentos, uno por uno, del 1 al 21, pero no los almacena en búfer, es decir, no puedo reproducir video, hay un cargador infinito.

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