当前位置: 首页>>代码示例>>C#>>正文


C# IAsset.GetHlsUri方法代码示例

本文整理汇总了C#中IAsset.GetHlsUri方法的典型用法代码示例。如果您正苦于以下问题:C# IAsset.GetHlsUri方法的具体用法?C# IAsset.GetHlsUri怎么用?C# IAsset.GetHlsUri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IAsset的用法示例。


在下文中一共展示了IAsset.GetHlsUri方法的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));
        }
开发者ID:debashish1976,项目名称:dotnetsdk,代码行数:62,代码来源:Program.cs

示例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;
        }
开发者ID:nakayamaqs,项目名称:Boy7,代码行数:18,代码来源:MediaService.cs

示例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


注:本文中的IAsset.GetHlsUri方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。