I need to include the sessionid and token in the stream URL request headers. How can I add custom request headers using the web SDK?

If you have any insights or suggestions, I would greatly appreciate your input. Thank you so much in advance for your time and support.

@madhuy1729 Thanks for reaching out to us. The headers can be passed in the stream request using the following options.

Option 1: Pass it as part of the source config

Reference documents:

  1. (SourceConfigOptions | Bitmovin Player API 8.125.1)

  2. (HttpHeaders | Bitmovin Player API 8.125.1)

var sourceConfig = {
    .....
    options: {
        headers :{
         }
        withCredentials: true
    },
};

Option 2: Using network.preprocessHttpRequest

var playerConfig = {
    ......
    network: {
            preprocessHttpRequest: (type, request) => {
                if (type === bitmovin.player.HttpRequestType.MANIFEST_DASH) { //adjust the condition based on your requirements
                    request.headers["token"] =  "value"
                }
                return Promise.resolve(request);
            }
1 Like

Thank you, @Kishore . It worked!

1 Like

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.