流式处理定位符Streaming Locators

Note

Google Widevine 内容保护服务目前在 Azure 中国区域不可用。Google Widevine content protection services are currently unavailable in the Azure China regions.

若要使输出资产中的视频可供客户端进行播放,必须创建流式处理定位符,然后生成流式处理 URL。To make videos in the output Asset available to clients for playback, you have to create a Streaming Locator and then build streaming URLs. 若要生成 URL,需要连接流式处理终结点主机名和流定位器路径。To build a URL, you need to concatenate the Streaming Endpoint host name and the Streaming Locator path. 对于 .NET 示例,请参阅获取流式处理定位符For .NET sample, see Get a Streaming Locator.

创建流定位符的过程称为发布。The process of creating a Streaming Locator is called publishing. 默认情况下,除非配置可选的开始和结束时间,否则调用 API 后,流定位符立即生效,并持续到被删除为止。By default, the Streaming Locator is valid immediately after you make the API calls, and lasts until it is deleted, unless you configure the optional start and end times.

创建流定位器时,必须指定资产名称和流式处理策略名称。When creating a Streaming Locator, you must specify an Asset name and a Streaming Policy name. 有关详细信息,请参阅以下主题:For more information, see the following topics:

还可以在流定位器上指定开始和结束时间,这将仅允许用户在这两个时间之间播放内容(例如,在 2019 年 5 月 1 日至 2019 年 5 月 5 日之间)。You can also specify the start and end time on your Streaming Locator, which will only let your user play the content between these times (for example, between 5/1/2019 to 5/5/2019).

注意事项Considerations

  • 流定位器不可更新。Streaming Locators are not updatable.
  • 属于日期/时间类型的流式处理定位符 的属性始终采用 UTC 格式。Properties of Streaming Locators that are of the Datetime type are always in UTC format.
  • 应为媒体服务帐户设计一组有限的策略,并在需要相同的选项时重新将这些策略用于流式处理定位符。You should design a limited set of policies for your Media Service account and reuse them for your Streaming Locators whenever the same options are needed. 有关详细信息,请参阅配额和限制For more information, see Quotas and limits.

创建流定位器Create Streaming Locators

未加密Not encrypted

如果想要明文(非加密)流式传输文件,请将预定义的明文流式处理策略设置为“Predefined_ClearStreamingOnly”(在 .NET 中,可以使用 PredefinedStreamingPolicy.ClearStreamingOnly 枚举)。If you want to stream your file in-the-clear (non-encrypted), set the predefined clear streaming policy: to 'Predefined_ClearStreamingOnly' (in .NET, you can use the PredefinedStreamingPolicy.ClearStreamingOnly enum).

StreamingLocator locator = await client.StreamingLocators.CreateAsync(
    resourceGroup,
    accountName,
    locatorName,
    new StreamingLocator
    {
        AssetName = assetName,
        StreamingPolicyName = PredefinedStreamingPolicy.ClearStreamingOnly
    });

加密Encrypted

如果需要使用 CENC 加密来加密内容,请将策略设置为“Predefined_MultiDrmCencStreaming”。If you need to encrypt your content with the CENC encryption, set your policy to 'Predefined_MultiDrmCencStreaming'. 密钥会根据配置的 DRM 许可证传送到播放客户端。The key will be delivered to a playback client based on the configured DRM licenses.

StreamingLocator locator = await client.StreamingLocators.CreateAsync(
    resourceGroup,
    accountName,
    locatorName,
    new StreamingLocator
    {
        AssetName = assetName,
        StreamingPolicyName = "Predefined_MultiDrmCencStreaming",
        DefaultContentKeyPolicyName = contentPolicyName
    });

如果还想使用 CBCS (FairPlay) 加密 HLS 流,请使用“Predefined_MultiDrmStreaming”。If you also want to encrypt your HLS stream with CBCS (FairPlay), use 'Predefined_MultiDrmStreaming'.

将筛选器与流定位器关联Associate filters with Streaming Locators

请参阅筛选器:与流定位器关联See Filters: associate with Streaming Locators.

对流定位器实体进行筛选、排序、分页Filter, order, page Streaming Locator entities

请参阅媒体服务实体的筛选、排序、分页See Filtering, ordering, paging of Media Services entities.

按资产名称列出流定位器List Streaming Locators by Asset name

若要基于关联的资产名称获取流定位器,请使用以下操作:To get Streaming Locators based on the associated Asset name, use the following operations:

语言Language APIAPI
RESTREST liststreaminglocatorsliststreaminglocators
CLICLI az ams asset list-streaming-locatorsaz ams asset list-streaming-locators
.NET.NET ListStreamingLocatorsListStreamingLocators
JavaJava AssetStreamingLocatorAssetStreamingLocator
Node.jsNode.js listStreamingLocatorslistStreamingLocators

另请参阅See also

后续步骤Next steps

如何创建流式处理定位符并生成 URLHow to create a streaming locator and build URLs