I have been working on an open source community project Azure Media Services has been uploading and playing videos in MVC since 2015. I didn’t use delivery encryption before, so I started working on AES.
In all the source codes / samples from the Azure Media Services Team, I noticed that a test token is generated immediately after loading the content, and this works well in my case. But how do I create a test token next time for playback?
I realized that we need a token every time a player requests playback. Technically, the player creates a request to a key service provider and receives an updated token.
So, to get the updated token, I tried a couple of ways: n could not fix it, I see the error "ContentKey (Id = '...", Type =' EnvelopeEncryption '), which contains the same types that already reference this asset. "

This seems like a valid error message because a key of type EnvelopeEncryption has already been added and associated with the active after loading the content, and after re-requesting this pop-up window.
Below is the code below .
public ActionResult Index() { var model = new List<VideoViewModel>(); var videos = db.Videos.OrderByDescending(o => o.Id).ToList(); foreach (var video in videos) { var viewModel = new VideoViewModel(); viewModel.Id = video.Id; viewModel.EncodedAssetId = video.EncodedAssetId; viewModel.IsEncrypted = video.IsEncrypted; viewModel.LocatorUri = video.LocatorUri;
The above method calls the network service provider.
How to fix it?
c # asp.net-mvc azure azure-media-services
Abhimanyu
source share