Hi I implemented private video using hls with hls.js and it works , I get the X-Token on the first request and add it to the xhr config on the follow up request. The part I can’t seem to get a solution for is when you want to use native support for hls , like for instance on an iphone then it does not support the mediaSource extension. So I can’t set a config to change the follow up headers to include the X-Token.
So my question is how can I add a custom header to the request the
I get a 404 error which I’ve discovered means that the X-Token-Session header is not set. After doing a bunch of research I learned that VideoJS uses Safari’s native HLS implementation.
This can be bypassed on macOS by setting videojs.options.vhs.overrideNative = true; which in turn sets videojs.Vhs.xhr.beforeRequest.
This is, however, not supported on iOS as there’s only partial support for MediaSource which in turn means that videojs.Vhs.xhr.beforeRequest is not called and the header is not set.
How can we set the header in Safari on iOS? How does the video.api player do it?
Unfortunately the only way to make private videos work on IOS is to use a service worker.
We have just uploaded a small sample application showing how it is possible to do this.