Search code examples
http-live-streamingvideo.js

How to add a parameter via videojs contrib-hls to requests triggered by m3u8 manifest from the browser side


Is there a way to add a parameter to each request that was triggered by an m3u8 manifest, from the browser side in videojs contrib-hls?

For instance - via a customised loader (like in this question).


Solution

  • videojs-contrib-hls was succeeded by http-streaming, which is included in Video.js v7 by default. You can set a function to modify each request with player.hls.xhr.beforeRequest.

    This only works if http-streaming is playing HLS with Media Source Extensions, it's not possible to change requests with browsers' native playback. For some browsers with native HLS support, the override native option can be used to ensure http-streaming plays the video but this is notably not possible on iOS, which does not support MSE.