0

I am trying to upload a video file and stream it with DRM using Azure Media Services, So far I managed to upload the file, get a streaming URL and get a token but when trying to play it on http://ampdemo.azureedge.net/ I am getting an error

Unable to decrypt encrypted video source 0x20500004

Been searching for a couple of hours now for what might cause the issue but haven't found anything that helped. I used this repo (and changed the keys to my own)

https://github.com/Azure-Samples/media-services-v3-node-tutorials/blob/main/StreamFilesWithDRMSample/index.ts

In addition, I created a content key policy named CommonEncryptionCencDrmContentKeyPolicy with license type PlayReady and Restriction type token

Can anyone help and share what am I missing here?

Thanks!

Ozure
  • 115
  • 2
  • 8

1 Answers1

0

Make sure you are using https:// for everything.... don't mix http: on any URLs That's usually the issue.

Update: I can't quite spot the issue within the token, but it could be something to do with the way that you have defined the restriction in the ContentKeyPolicyTokenRestriction object.

Make sure that your issuer and audience match what you passed into the JWT token. If the sample worked for you, it might be the difference.

let restriction: ContentKeyPolicyTokenRestriction = { odataType: "#Microsoft.Media.ContentKeyPolicyTokenRestriction", issuer: issuer, audience: audience, primaryVerificationKey: primaryKey, restrictionTokenType: "Jwt", alternateVerificationKeys: undefined, requiredClaims: requiredClaims }

Check through all pats that set the Content Key Policy token restriction up, and make sure that it matches your required claims passed into the JWT token.

johndeu
  • 2,494
  • 1
  • 11
  • 10
  • Forgot to add - you should read line 502. :-) I put that in there after many folks hit this. https://github.com/Azure-Samples/media-services-v3-node-tutorials/blob/33f64f907172d52619912a86898058a6a976132f/StreamFilesWithDRMSample/index.ts#L502 – johndeu Dec 17 '21 at 18:09
  • I think I am using https, I am sending the following link pattern: https://projecthubams-euwe.streaming.media.azure.net/{uuid}/{manifest}(encryption=cenc)&playready=true&widevine=true&token=Bearer%20${token} So I use HTTPS on the URL, Any other issues that might make it happen? – Ozure Dec 17 '21 at 18:36
  • Make sure you are loading the https version of the amp demo page. Stack wont let me paste the URL, so breaking it up a bit FYI - https:// and then ampdemo.azureedge.net/azuremediaplayer.html – johndeu Dec 17 '21 at 22:13
  • It isn't working, I am using the following URL: https://ampdemo.azureedge.net/azuremediaplayer.html And still getting the same error, I checked that the key matches the Primary verification key and that all of the settings are the same but it still does not work. – Ozure Dec 18 '21 at 08:13
  • @Ozure I should have asked a couple more. What browser are you testing in? What Os? Did the basic sample work without altering. I just tested several times and sample “works on my machine” – johndeu Dec 18 '21 at 16:10
  • Hey, I am testing on chrome, windows 10, the basic sample works perfectly. I think i might be missing something something and i really can't figure out what. My decoded token looks like this: { "urn:microsoft:azure:mediaservices:contentkeyidentifier": "92fd1f2d-57e3-47dc-b91f-2a0f4fce6dc0", "exp": 1639929683, "nbf": 1639842983, "iat": 1639843283, "aud": "https://challengeapp.com", "iss": "https://challengeapp.com" } – Ozure Dec 18 '21 at 16:19
  • I can't quite spot the issue within the token, but it could be something to do with the way that you have defined the restriction in the ContentKeyPolicyTokenRestriction object. Make sure that your issuer and audience match what you passed into the JWT token. If the sample worked for you, it might be the difference. – johndeu Dec 18 '21 at 21:31
  • Ok, I deleted the ContentKeyPolicyKey and created it from the code and now it works fine, I don't really know what was the issue there because it was looking the same. So it works now, another question though, is how can I play the video on a custom player? like videojs? I couldn't really figure out how to pass the token. – Ozure Dec 19 '21 at 10:44