How to set authentication token to any request for getting captions in Azure Media Player

Khanh Dinh Duy 15 Reputation points
2023-03-28T10:02:03.45+00:00

Hi,

I want to add authenticate token to Header for each request is called by Azure media player to get caption content, because all captions link need to be protected by our middleware. I try with Protection Info but it's not working.

https://learn.microsoft.com/en-us/azure/media-services/azure-media-player/azure-media-player-protected-content

https://amp.azure.net/libs/amp/latest/docs/index.html#amp.player.protectioninfo

Thanks.

Azure Media Services
Azure Media Services
A group of Azure services that includes encoding, format conversion, on-demand streaming, content protection, and live streaming services.
317 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. brtrach-MSFT 16,506 Reputation points Microsoft Employee
    2023-04-02T21:46:21.51+00:00

    To add an authentication token to the header for each request called by Azure Media Player to get caption content, you can use the ProtectionInfo object in Azure Media Player. The ProtectionInfo object allows you to specify a token that will be added to the header of each request made by the player.

    Here is an example of how to use the ProtectionInfo object to add an authentication token to the header:

    var myOptions = {
        "nativeControlsForTouch": false,
        "controls": true,
        "autoplay": false,
        "width": "640",
        "height": "400",
        "plugins": {
            "azuremediaplayer": {
                "src": "http://amssamples.streaming.mediaservices.windows.net/69fbaeba-8e92-43f2-867a-fb033bdc6d2f/AzureMediaServicesPromo.ism/manifest",
                "protectionInfo": [{
                    "type": "AES",
                    "authenticationToken": "your-authentication-token"
                }]
            }
        }
    };
    

    In the protectionInfo object, you can specify the type of protection you want to use (in this case, AES) and the authentication token you want to add to the header of each request.

    For more information on how to use the ProtectionInfo object in Azure Media Player, you can refer to the official documentation.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.