Azure-Samples / media-services-v3-dotnet

The projects in this repository show how to implement different Azure Media Services scenarios using the v3 version.
MIT License
58 stars 52 forks source link

BasicAESClearKey sample not working ("No policy option is found for the request key type.") #123

Closed mirzavucijak closed 1 year ago

mirzavucijak commented 1 year ago

This issue is for a:

- [ ] bug report -> please search issues before submitting
- [ ] feature request
- [x] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Clone and run sample under BasicAESClearKey (code: https://github.com/Azure-Samples/media-services-v3-dotnet/tree/main/ContentProtection/BasicAESClearKey)

Once the code runs it dumps a generated URL for online Azure Media Player, however the player reports an issue:

Any log messages given by the failure

The Azure Media Player reports error: Unable to decrypt the encrypted video source. 0x20500006

image

The diagnostics logs report error: "No policy option is found for the request key type."

Here is a complete dump of diagnostics logs from the ampdemo.azureedge.net page:

user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36
source: https://amspoctest-euwe.streaming.media.azure.net/b7d2ceb6-29eb-451a-a888-dacaafcdc2fd/Ignite-short.ism/manifest(format=mpd-time-csf,encryption=cenc)
17:10:52.557 | amp: loadedmetadata, currentTime: 0
17:10:52.562 | amp: loadstart, currentTime: 0
17:10:52.627 | amp: durationchange, currentTime: 0
17:10:52.834 | amp: downloadbitratechanged 917222, currentTime: 0
17:10:52.856 | amp: canplaythrough, currentTime: 0
17:10:53.414 | amp: loadstart, currentTime: 0
17:10:53.467 | amp: loadedmetadata, currentTime: 0
17:10:53.472 | amp: loadstart, currentTime: 0
17:10:53.479 | amp: downloadbitratechanged 917222, currentTime: 0
17:10:53.494 | amp: canplaythrough, currentTime: 0
17:10:53.495 | amp: seeking, currentTime: 0.2
17:10:53.948 | amp: error code: 0x20500006 msg: Http: 0x00200191, reponse: {
  "Error": {
    "Message": "No policy option is found for the request key type.",
    "Code": "PolicyOptionNotFound"
  }
}, currentTime: 0

Expected/desired behavior

For the generated sample and code to work. I've been trying to add JWTs to my own videos and struggling with exact same issue. Desperate as I was I tried to run your provided sample - still receive the same. Not sure if it's code issue with sample or with Azure Media Player, but I couldn't find any other documentation on this.

OS and Version?

Windows 11 x64, Chrome 111.0.5563.65

Versions

Code sample taken from the main branch.

Mention any other details that might be useful

None. You can reproduce the issue by simply re-running the sample, regardless of your AMS setup.

xpouyat commented 1 year ago

Hello, Thanks for the reporting. The bug has been fixed now for the AES sample https://github.com/Azure-Samples/media-services-v3-dotnet/commit/7d73ce3e3e04e8c35ab91141f25d7b428e4c6a09#diff-fafbc447e394195f877c31b9e24444d0b741f77ab45061e06b4e2e6a7c0a76ad

mirzavucijak commented 1 year ago

Thank you @xpouyat ! I've verified changing policy name to Predefined_ClearKey fixed the issue and the videos are now properly secured with JWT.

I'm closing the issue.