private static async Task<StreamingLocator> CreateStreamingLocatorAsync(
IAzureMediaServicesClient client,
string resourceGroup,
string accountName,
string assetName,
string locatorName,
string contentPolicyName)
{
CommonEncryptionCbcs objStreamingPolicyInput = new CommonEncryptionCbcs()
{
Drm = new CbcsDrmConfiguration()
{
FairPlay = new StreamingPolicyFairPlayConfiguration()
{
AllowPersistentLicense = true // This enables offline mode
}
},
EnabledProtocols = new EnabledProtocols()
{
Hls = true,
Dash = true // Even though DASH under CBCS is not supported for either CSF or CMAF, HLS-CMAF-CBCS uses DASH-CBCS fragments in its HLS playlist
},
ContentKeys = new StreamingPolicyContentKeys()
{
// Default key must be specified if keyToTrackMappings is present
DefaultKey = new DefaultKey()
{
Label = "CBCS_DefaultKeyLabel"
}
}
};
// If you also added FairPlay, use "Predefined_MultiDrmStreaming
StreamingLocator locator = await client.StreamingLocators.CreateAsync(
resourceGroup,
accountName,
locatorName,
new StreamingLocator
{
AssetName = assetName,
// "Predefined_MultiDrmCencStreaming" policy supports envelope and cenc encryption
// And sets two content keys on the StreamingLocator
StreamingPolicyName = nameof(objStreamingPolicyInput),
DefaultContentKeyPolicyName = contentPolicyName
});
return locator;
}
根据我的理解,我应该创建“ objStreamingPolicyInput ”,然后在创建流式定位器时替换“ StreamingPolicyName ”,但似乎不起作用。请问有什么帮助吗?
错误:
Operation returned an invalid status code 'BadRequest'
ERROR: API call failed with error code 'BadRequest' and message 'Streaming Policy is not found: objStreamingPolicyInput'