I have tried to play encrypted video using token, video media source is Azure media cloud server, it works fine. I have got solution to play encrypted video How to prevent play video using file path of window azure media server without login? But further How to prevent access as saved content as HTML format offline because it has Authentication Token as well as Encrypted Smooth url?
There are few solutions(or combination) you can use utilizing token authentication capabilities in Azure Media services.
Integrating with Identity provider: - You can integrate your video web app to use sign in JWT token obtained from one of identity providers. See example how to integrate with Azure active directory . You can restrict access to video only to users having specific group claims. In these set of scenarios you rely on token claims obtained from identity provider.Relying on identity provider gives you simplicity of not composing jwt and utilize predefined/configurable set of claims such as user group membership, geographic location and etc. Your video hosted in Azure Media Service will be playable until token will expire.
Generating and signing token within your app. - If you generating tokens within your web app you can define token expiration to be comparable to video playback time length. You can have client side JavaScript event initiating a request to receive a jwt token from server before user clicks on playback. Once Jwt token received you can update your video player parameters with token .You have more flexibility in selecting set of jwt claims if your web application generates jwt token. For example you can generate authentication policies only for specific logged in user . In this scenarios saving html will not expose a token since it is obtained dynamically based on user actions.