本文整理匯總了C#中Microsoft.WindowsAzure.MediaServices.Client.CloudMediaContext.FindAssetById方法的典型用法代碼示例。如果您正苦於以下問題:C# CloudMediaContext.FindAssetById方法的具體用法?C# CloudMediaContext.FindAssetById怎麽用?C# CloudMediaContext.FindAssetById使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Microsoft.WindowsAzure.MediaServices.Client.CloudMediaContext
的用法示例。
在下文中一共展示了CloudMediaContext.FindAssetById方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Main
static int Main(string[] args)
{
if (args.Length != 1)
{
Console.Error.WriteLine("MP4ToHLS <asset-id>");
return -1;
}
string accountName = Environment.GetEnvironmentVariable("ACCOUNT_NAME");
string accountKey = Environment.GetEnvironmentVariable("ACCOUNT_KEY");
CloudMediaContext cloudMediaContext = new CloudMediaContext(accountName, accountKey);
string assetId = args[0];
IAsset asset = cloudMediaContext.FindAssetById(assetId);
IJob job = cloudMediaContext.Jobs.Create(string.Format("Convert {0} to HLS Asset", asset.Name));
IMediaProcessor processor = cloudMediaContext.GetMediaProcessor("Windows Azure Media Encoder");
ITask task = job.Tasks.AddNew("MP4 to HLS",
processor,
"H264 Adaptive Bitrate MP4 Set SD 16x9",
Microsoft.WindowsAzure.MediaServices.Client.TaskOptions.ProtectedConfiguration);
task.InputAssets.Add(asset);
task.OutputAssets.AddNew(string.Format("HLS for {0}", asset.Name),
AssetCreationOptions.None);
job.Submit();
Console.WriteLine(job.Id);
Console.WriteLine("Once job is complete, retrieve StreamingURL and append (format=m3u8-aapl)");
return 0;
}