RenderHeads / UnityPlugin-AVProVideo

AVPro Video is a multi-platform Unity plugin for advanced video playback
https://www.renderheads.com/products/avpro-video/
233 stars 28 forks source link

Cannot play AES-128 Encrypted HLS stream from Azure on Windows #1516

Closed seanhalls3 closed 1 year ago

seanhalls3 commented 1 year ago

Please DO NOT LINK / ATTACH YOUR PROJECT FILES HERE

Describe the issue Cannot Playback AES-128 Encrypted HLS stream from Azure on Windows in the Unity Editor.

Your Setup (please complete the following information):

To Reproduce

  1. In the Demo_MediaPlayer scene, on the MediaPlayer component in the inspector, edit the Media Source to the "Path" and insert for the Absolute Path or URL: https://s3gmediatennis-usw22.streaming.media.azure.net/1e838a8b-4016-43cf-b30b-15759cb66f23/280cbf74-38aa-4b42-84a1-951c2d18a4da.ism/manifest(format=m3u8-cmaf,encryption=cbc)
  2. Under Platform Specific settings for Windows, edit the Video API to "Win RT" and then under HLS Decryption, insert for the Auth Token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1cm46bWljcm9zb2Z0OmF6dXJlOm1lZGlhc2VydmljZXM6Y29udGVudGtleWlkZW50aWZpZXIiOiIxZGEyZmQ5OC1hMzc4LTQ5ZWYtYTA2OC1hOTYxNzg3ZjZjZTAiLCJ1cm46bWljcm9zb2Z0OmF6dXJlOm1lZGlhc2VydmljZXM6bWF4dXNlcyI6IjEwMDAiLCJuYmYiOjE2ODIwMDE0ODksImV4cCI6MTY4MjEzMTA4MCwiaXNzIjoiczNnIiwiYXVkIjoicHJpdmF0ZSJ9.4rhMEeJ5S3y9D8T76xdJ0mRUo20xCk-F7QLiHJFMefc
  3. Make sure Auto Play is checked for MediaPlayer, then press "play" at the top of the Unity editor to run in editor.
  4. Another method that produces the same result is forcing the key, which is presented here base64 encoded: 99EyFoW2J4aFBkTg5SE5Jg==

Logs [AVProVideo] Error: Loading failed. File not found, codec not supported, video resolution too high or insufficient system resources. UnityEngine.Debug:LogError (object) RenderHeads.Media.AVProVideo.MediaPlayer:UpdateErrors () (at Assets/AVProVideo/Runtime/Scripts/Components/MediaPlayer.cs:1399) RenderHeads.Media.AVProVideo.MediaPlayer:Update () (at Assets/AVProVideo/Runtime/Scripts/Components/MediaPlayer.cs:827)

Screenshots image

Videos https://s3gmediatennis-usw22.streaming.media.azure.net/1e838a8b-4016-43cf-b30b-15759cb66f23/280cbf74-38aa-4b42-84a1-951c2d18a4da.ism/manifest(format=m3u8-cmaf,encryption=cbc)

It's important to note the token will expire in a day. Contact me for a new one. Here is a link to an example of the stream decrypting and playing correctly in a web player: https://ampdemo.azureedge.net/?url=https%3A%2F%2Fs3gmediatennis-usw22.streaming.media.azure.net%2F1e838a8b-4016-43cf-b30b-15759cb66f23%2F280cbf74-38aa-4b42-84a1-951c2d18a4da.ism%2Fmanifest(format%3Dm3u8-cmaf%2Cencryption%3Dcbc)&aes=true&aestoken=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1cm46bWljcm9zb2Z0OmF6dXJlOm1lZGlhc2VydmljZXM6Y29udGVudGtleWlkZW50aWZpZXIiOiIxZGEyZmQ5OC1hMzc4LTQ5ZWYtYTA2OC1hOTYxNzg3ZjZjZTAiLCJ1cm46bWljcm9zb2Z0OmF6dXJlOm1lZGlhc2VydmljZXM6bWF4dXNlcyI6IjEwMDAiLCJuYmYiOjE2ODIwMDE0ODksImV4cCI6MTY4MjEzMTA4MCwiaXNzIjoiczNnIiwiYXVkIjoicHJpdmF0ZSJ9.4rhMEeJ5S3y9D8T76xdJ0mRUo20xCk-F7QLiHJFMefc

Please DO NOT LINK / ATTACH YOUR PROJECT FILES HERE

Instead email the link to us unitysupport@renderheads.com

seanhalls3 commented 1 year ago

It's important to note that the token will expire in a day. Just ask me for a new token if needed for testing. Also here is an example of this stream decrypting and playing correctly in a web player:

https://ampdemo.azureedge.net/?url=https%3A%2F%2Fs3gmediatennis-usw22.streaming.media.azure.net%2F1e838a8b-4016-43cf-b30b-15759cb66f23%2F280cbf74-38aa-4b42-84a1-951c2d18a4da.ism%2Fmanifest(format%3Dm3u8-cmaf%2Cencryption%3Dcbc)&aes=true&aestoken=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1cm46bWljcm9zb2Z0OmF6dXJlOm1lZGlhc2VydmljZXM6Y29udGVudGtleWlkZW50aWZpZXIiOiIxZGEyZmQ5OC1hMzc4LTQ5ZWYtYTA2OC1hOTYxNzg3ZjZjZTAiLCJ1cm46bWljcm9zb2Z0OmF6dXJlOm1lZGlhc2VydmljZXM6bWF4dXNlcyI6IjEwMDAiLCJuYmYiOjE2ODIwMDE0ODksImV4cCI6MTY4MjEzMTA4MCwiaXNzIjoiczNnIiwiYXVkIjoicHJpdmF0ZSJ9.4rhMEeJ5S3y9D8T76xdJ0mRUo20xCk-F7QLiHJFMefc

seanhalls3 commented 1 year ago

I'm guessing the trial version doesn't have 128-AES playback capabilities?

seanhalls3 commented 1 year ago

New key for today if anyone wants to help:

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1cm46bWljcm9zb2Z0OmF6dXJlOm1lZGlhc2VydmljZXM6Y29udGVudGtleWlkZW50aWZpZXIiOiIxZGEyZmQ5OC1hMzc4LTQ5ZWYtYTA2OC1hOTYxNzg3ZjZjZTAiLCJ1cm46bWljcm9zb2Z0OmF6dXJlOm1lZGlhc2VydmljZXM6bWF4dXNlcyI6IjEwMDAiLCJuYmYiOjE2ODI2OTY2NzEsImV4cCI6MTY4Mjc4MzA3MCwiaXNzIjoiczNnIiwiYXVkIjoicHJpdmF0ZSJ9.73fVlFtxMy5ugiNt9AEKVboTA-z9hAIcbLvUuQu3K84

And url for working example (that only works today): https://ampdemo.azureedge.net/?url=https%3A%2F%2Fs3gmediatennis-usw22.streaming.media.azure.net%2F1e838a8b-4016-43cf-b30b-15759cb66f23%2F280cbf74-38aa-4b42-84a1-951c2d18a4da.ism%2Fmanifest(format%3Dm3u8-cmaf%2Cencryption%3Dcbc)&aes=true&aestoken=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1cm46bWljcm9zb2Z0OmF6dXJlOm1lZGlhc2VydmljZXM6Y29udGVudGtleWlkZW50aWZpZXIiOiIxZGEyZmQ5OC1hMzc4LTQ5ZWYtYTA2OC1hOTYxNzg3ZjZjZTAiLCJ1cm46bWljcm9zb2Z0OmF6dXJlOm1lZGlhc2VydmljZXM6bWF4dXNlcyI6IjEwMDAiLCJuYmYiOjE2ODI2OTY2NzEsImV4cCI6MTY4Mjc4MzA3MCwiaXNzIjoiczNnIiwiYXVkIjoicHJpdmF0ZSJ9.73fVlFtxMy5ugiNt9AEKVboTA-z9hAIcbLvUuQu3K84

Chris-RH commented 1 year ago

Hi, sorry the URL was posted after work hours on Friday, and we've had a long weekend here in the UK, so I've just got back to this today.. Are you able to put a new one up for tomorrow please?

AES-128 does work in the trial. Here is an Azure Media Services Sample Stream to test: https://amssamples.streaming.mediaservices.windows.net/830584f8-f0c8-4e41-968b-6538b9380aa5/TearsOfSteelTeaser.ism/manifest(format=m3u8-aapl)

eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1cm46bWljcm9zb2Z0OmF6dXJlOm1lZGlhc2VydmljZXM6Y29udGVudGtleWlkZW50aWZpZXIiOiI5ZGRhMGJjYy01NmZiLTQxNDMtOWQzMi0zYWI5Y2M2ZWE4MGIiLCJpc3MiOiJodHRwOi8vdGVzdGFjcy5jb20vIiwiYXVkIjoidXJuOnRlc3QiLCJleHAiOjE3MTA4MDczODl9.lJXm5hmkp5ArRIAHqVJGefW2bcTzd91iZphoKDwa6w8

seanhalls3 commented 1 year ago

UPDATE: I removed the token and it still played... I am reviewing why that might be as it represents a huge security risk in itself.

I tested the link you sent and it worked successfully. I went ahead and compared the manifests and was reviewing some related documentation and found that I can alter my video's URL to use the same HLS formatting as the URL you sent... so I tried it and it worked!

So the solution was that I changed my URL for the video in the original post to this: https://s3gmediatennis-usw22.streaming.media.azure.net/1e838a8b-4016-43cf-b30b-15759cb66f23/280cbf74-38aa-4b42-84a1-951c2d18a4da.ism/manifest(format=m3u8-aapl,encryption=cbc)

Selecting the m3u8-aapl (V4) HLS format instead of m3u8-cmaf (CMAF) HLS format was the answer in this case.

Thank you for your help!

seanhalls3 commented 1 year ago

UPDATE: Some sort of caching was at play. It does in fact work. Apologies once again.

I closed this prematurely. I apologize.

I removed the token and it still played... I am reviewing why that might be as it represents a huge security risk in itself.

seanhalls3 commented 1 year ago

Nevermind, something was cached such that I could still play after having once successfully negotiated security. I closed and reopened Unity and everything worked as expected. Re-closing!