Azure Media Services V2至V3升级 - 自定义密钥交付服务:如何提供清晰的钥匙值

发布于 2025-01-17 16:36:58 字数 977 浏览 3 评论 0原文

我正在尝试将 Azure 媒体服务 v2 实现升级到使用自定义密钥传送服务的 v3 此处提到到 v3。除了本节和 REST API 部分的示例之外,我发现这在很大程度上没有记录,但我相信我已经弄清楚了大部分内容,但是在密钥的实际交付中,我想知道我返回的格式是否为正确的格式(我在任何地方都找不到这个)。尽管我看到请求通过并被发送回,但视频播放器似乎无法正常工作。

我是否以 ByteArray 格式返回密钥,如下面的 v3 示例所示?

媒体服务 v2 实施

    private HttpResponseMessage GetKeyHttpResponse(IContentKey key)
    {
        var res = Request.CreateResponse(HttpStatusCode.OK);
        res.Content = new ByteArrayContent(key.GetClearKeyValue());

        return res;
    }

媒体服务 v3 尝试

    private HttpResponseMessage GetKeyHttpResponse(StreamingLocatorContentKey key)
    {
        var res = Request.CreateResponse(HttpStatusCode.OK);
        res.Content = new ByteArrayContent(Encoding.ASCII.GetBytes(key.Value));

        return res;
    }

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;
    }

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情丝乱 2025-01-24 16:36:58

非常感谢上面的@Sanjid,这里是工作解决方案(使用客户端视频播放器进行测试)。

    private HttpResponseMessage GetKeyHttpResponse(StreamingLocatorContentKey key)
    {
        var res = Request.CreateResponse(HttpStatusCode.OK);
        res.Content = new ByteArrayContent(Convert.FromBase64String(key.Value));

        return res;
    }

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;
    }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文