Fetch partial content (206) with Object URL

328 Views Asked by At

I have an API that returns video stream with partial content (206) support. But this API needs some custom headers like authentication, so I use fetch to get the stream and create object URL.

I've created a fetch request:

let vidSrc = fetch(".../video", {
   headers: {
       Authorization: ...
   }
}).then((data) => {
   return URL.createObjectURL(data);
});

videoElement.src = vidSrc;

But then the object URL doesn't transfer the range request to the API service.

How can I get the partial content support with fetch and object URLs?

0

There are 0 best solutions below