For reasons beyond my paygrade, I'm stuck with determining the feasibility of performing an AJAX request to our backend and using its response as the src
of a <video>
tag. The primary reason for having to perform an AJAX request is that we're adding some mandatory headers that are verified on the backend.
So far, I've come across several StackOverflow posts, 1 2 3 4, that are on the same lines and don't really provide a solution. However, the following MDN link regarding MediaSource looks promising although I believe it attempts to download the entire video before it can play it. It also looks like WebTorrent achieves something very similar to this albeit in a streaming (and preferred) fashion.
Is there a simple approach for playing a video from an AJAX response stream?