Azure媒体服务定位器 [英] Azure Media Services Locators

查看:59
本文介绍了Azure媒体服务定位器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据上一个问题,我仍然找不到定位器.

base of my previous question I still don't get locators.

上一个定位器问题

如果我创建了一个持续1个小时的定位器,当它过期时,我如何知道当前的定位器已过期?

If I create a locator to last 1 hour, when it expires how do I know that the current locator has expired?

我相信我将需要存储assetId,以便以后可以请求它.

I believe I will need to store the assetId so I can later request it.

  • 我也要在我的身边保存有效期吗?
  • 或者是当我请求它时,我获得了无效的http状态,并以此为基础创建了一个新的定位器?
  • 所有过期的定位器会发生什么情况,我读到您只有5个,所以我需要清理过期的定位器吗?

认为主要问题是,当旧的定位器过期时如何创建新的定位器,但是我怎么知道旧的定位器过期了?

Think the main question is how do I create a new locator when the old locator is expired, but how do I know that the old locator is expired?

下面的代码是我获取定位器的代码,但是无法找出定位器是否过期.

The code below is what I have for getting a locator, but no way of finding out if the locator has expired.

        // Try and get an access policy and reuse it if found
        var tempPolicyId = from a in _context.AccessPolicies
            where a.Name == PolicyName
            select a;

        IAccessPolicy accessPolicy = null;

        if (tempPolicyId.Count() < 1)
        {
            accessPolicy = _context.AccessPolicies.Create(
                PolicyName,
                TimeSpan.FromMinutes(5), // expire in 5 minutes
                AccessPermissions.List | AccessPermissions.Read);
        }
        else
        {
            accessPolicy = tempPolicyId.FirstOrDefault();
        }
        _context.Locators.CreateLocator(
            LocatorType.OnDemandOrigin,
            asset,
            accessPolicy,
            DateTime.UtcNow.AddMinutes(-5));

        _context.Locators.CreateLocator(
            LocatorType.Sas,
            asset,
            accessPolicy,
            DateTime.UtcNow.AddMinutes(-5));
    }

非常感谢您的帮助

推荐答案

我强烈建议您最少存储资产ID.从中您可以找到关于资产的几乎所有信息.如果您使用的是建议的寿命短的定位器,则存储到期日期并不是一件坏事.我认为这是短命的1个小时.通常,我会创建10或100年的定位器,然后通过DRM管理访问.

I would highly recommend minimally storing the asset ID. From that you can find out just about anything about the asset. It wouldn't be bad to store the expiry date if you are using short lived locators like you're suggesting. I'd consider 1 hour short lived. Often I create 10 or 100 year locators and then manage access through DRM.

要知道定位器何时到期,可以致电

To tell when a locator is expiring you can call ILocator.ExpirationDateTime.ToUniversalTime() to find the date/time that it will or did expire.

当定位器过期时,如果您处于5个定位器限制内,则需要删除该定位器,然后才能添加新的定位器.您还可以致电

When a locator is expired you need to delete if it you are at the 5 locator limit before you can add a new one. You can also call ILocator.Update(DateTime newExpiryTime)

这篇关于Azure媒体服务定位器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆