'Azure Media Services v2 to v3 Upgrade - Custom Key Delivery Service: how to provide Clear Key Value
I am trying to upgrade an Azure Media Services v2 implementation to v3 which uses a Custom Key Delivery Service mentioned here to v3. Other than this section and samples from the REST API section, I have found this to be largely undocumented but I believe I have figured out mostly everything, however on the actual Delivery of the Key I am wondering if the format I am returning is in the correct format (I cannot find this easily anywhere). It seems that the Video Player is not working even though I see the request come through and getting sent back out.
Do I return the key in ByteArray format as seen in my v3 example below?
Media Services v2 Implementation
private HttpResponseMessage GetKeyHttpResponse(IContentKey key)
{
var res = Request.CreateResponse(HttpStatusCode.OK);
res.Content = new ByteArrayContent(key.GetClearKeyValue());
return res;
}
Media Services v3 Attempt
private HttpResponseMessage GetKeyHttpResponse(StreamingLocatorContentKey key)
{
var res = Request.CreateResponse(HttpStatusCode.OK);
res.Content = new ByteArrayContent(Encoding.ASCII.GetBytes(key.Value));
return res;
}
Solution 1:[1]
Many thanks to @Sanjid above, here is the working solution (tested with a Client Side Video Player).
private HttpResponseMessage GetKeyHttpResponse(StreamingLocatorContentKey key)
{
var res = Request.CreateResponse(HttpStatusCode.OK);
res.Content = new ByteArrayContent(Convert.FromBase64String(key.Value));
return res;
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Philip Young |
