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

199
Vistas
Range header, video

First of all, don't ask me why I'm duing this thing, but I'm just curious if I can attain it.

I request a video from a server using the Range-header. The server sends me a buffer data of the video. In general I have about 3 request and then I have the full array of all three array buffers. Can I somehow concat them and then, converting the concatenation to a blob, create a url using URL.createObjectUrl to watch the video?

(In the following code, let's just assume we don't get fetch errors)

const getVideoBuffers = async (ranges, currentBuffers = [], i = 0) => {
  const res = await fetch("video", { headers: { Range: ranges[i] } });
  const buffer = await res.arrayBuffer();
  currentBuffers.push(buffer);
  i += 1;
  if (res.ok && res.status !== 206) return currentBuffers;
  return getVideoBuffers(ranges, currentBuffers, i);
}

const videoRanges = [...];
const buffers = await getVideoBuffers(videoRanges);
// Need this function
const concatedBuffers = concatBuffers(buffers);
const blob = new Blob([concatedBuffers], { type: "video/mp4" });
const url = URL.createObjectUrl(blob);
const video = document.createElement("video");
video.src = url;

Or am I thinking completely wrong? Then, how can I achieve the desired thing?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Blob instantiations allow for multiple ArrayBuffers to be concatenated:

new Blob([ ab1, ab2, ab3 ])
about 4 years ago · Juan Pablo Isaza Denunciar
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