本文整理汇总了C#中IAsset.GetMpegDashUri方法的典型用法代码示例。如果您正苦于以下问题:C# IAsset.GetMpegDashUri方法的具体用法?C# IAsset.GetMpegDashUri怎么用?C# IAsset.GetMpegDashUri使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAsset
的用法示例。
在下文中一共展示了IAsset.GetMpegDashUri方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PublishAssetGetURLs
public static void PublishAssetGetURLs(IAsset asset)
{
// Publish the output asset by creating an Origin locator for adaptive streaming,
// and a SAS locator for progressive download.
_context.Locators.Create(
LocatorType.OnDemandOrigin,
asset,
AccessPermissions.Read,
TimeSpan.FromDays(30));
_context.Locators.Create(
LocatorType.Sas,
asset,
AccessPermissions.Read,
TimeSpan.FromDays(30));
IEnumerable<IAssetFile> mp4AssetFiles = asset
.AssetFiles
.ToList()
.Where(af => af.Name.EndsWith(".mp4", StringComparison.OrdinalIgnoreCase));
// Get the Smooth Streaming, HLS and MPEG-DASH URLs for adaptive streaming,
// and the Progressive Download URL.
Uri smoothStreamingUri = asset.GetSmoothStreamingUri();
Uri hlsUri = asset.GetHlsUri();
Uri mpegDashUri = asset.GetMpegDashUri();
// Get the URls for progressive download for each MP4 file that was generated as a result
// of encoding.
List<Uri> mp4ProgressiveDownloadUris = mp4AssetFiles.Select(af => af.GetSasUri()).ToList();
// Display the streaming URLs.
Console.WriteLine("Use the following URLs for adaptive streaming: ");
Console.WriteLine(smoothStreamingUri);
Console.WriteLine(hlsUri);
Console.WriteLine(mpegDashUri);
Console.WriteLine();
// Display the URLs for progressive download.
Console.WriteLine("Use the following URLs for progressive download.");
mp4ProgressiveDownloadUris.ForEach(uri => Console.WriteLine(uri + "\n"));
Console.WriteLine();
// Download the output asset to a local folder.
string outputFolder = "job-output";
if (!Directory.Exists(outputFolder))
{
Directory.CreateDirectory(outputFolder);
}
Console.WriteLine();
Console.WriteLine("Downloading output asset files to a local folder...");
asset.DownloadToFolder(
outputFolder,
(af, p) =>
{
Console.WriteLine("Downloading '{0}' - Progress: {1:0.##}%", af.Name, p.Progress);
});
Console.WriteLine("Output asset files available at '{0}'.", Path.GetFullPath(outputFolder));
}
示例2: GetAdaptiveStreamingURLs
/// <summary>
/// Refer to: http://msdn.microsoft.com/en-us/library/jj889436.aspx
/// </summary>
/// <param name="asset"></param>
/// <returns></returns>
public static List<Uri> GetAdaptiveStreamingURLs(IAsset asset)
{
// Generate the Smooth Streaming, HLS and MPEG-DASH URLs for adaptive streaming.
Uri smoothStreamingUri = asset.GetSmoothStreamingUri(); //for MS XBOX etc.
Uri hlsUri = asset.GetHlsUri(); //For Apple devices
Uri mpegDashUri = asset.GetMpegDashUri(); //The ISO standard
var result = new List<Uri>();
result.Add(smoothStreamingUri);
result.Add(hlsUri);
result.Add(mpegDashUri);
return result;
}
示例3: PublishAssetGetURLs
static public void PublishAssetGetURLs(IAsset asset, bool onDemaindURL = true, string fileExt = "")
{
// Publish the output asset by creating an Origin locator for adaptive streaming,
// and a SAS locator for progressive download.
if (onDemaindURL)
{
_context.Locators.Create(
LocatorType.OnDemandOrigin,
asset,
AccessPermissions.Read,
TimeSpan.FromDays(30));
// Get the Smooth Streaming, HLS and MPEG-DASH URLs for adaptive streaming,
// and the Progressive Download URL.
Uri smoothStreamingUri = asset.GetSmoothStreamingUri();
Uri hlsUri = asset.GetHlsUri();
Uri mpegDashUri = asset.GetMpegDashUri();
// Display the streaming URLs.
Console.WriteLine("Use the following URLs for adaptive streaming: ");
Console.WriteLine(smoothStreamingUri);
Console.WriteLine(hlsUri);
Console.WriteLine(mpegDashUri);
Console.WriteLine();
}
else
{
_context.Locators.Create(
LocatorType.Sas,
asset,
AccessPermissions.Read,
TimeSpan.FromDays(30));
IEnumerable<IAssetFile> assetFiles = asset
.AssetFiles
.ToList()
.Where(af => af.Name.EndsWith(fileExt, StringComparison.OrdinalIgnoreCase));
// Get the URls for progressive download for each specified file that was generated as a result
// of encoding.
List<Uri> sasUris = assetFiles.Select(af => af.GetSasUri()).ToList();
// Display the URLs for progressive download.
Console.WriteLine("Use the following URLs for progressive download.");
sasUris.ForEach(uri => Console.WriteLine(uri + "\n"));
Console.WriteLine();
}
}
开发者ID:smartek,项目名称:media-services-dotnet-on-demand-encoding-with-media-encoder-standard,代码行数:51,代码来源:Program.cs