Wou*_*out 1 .net c# sdk azure azure-media-services
我正在使用Windows Azure媒体服务.NET SDK 3来利用流服务。我想检索视频的时长。如何使用Windows Azure Media Services .NET SDK 3检索视频的持续时间?
小智 5
Azure创建了一些可以在持续时间内查询的元数据文件(xml)。使用媒体服务扩展名可以访问这些文件
https://github.com/Azure/azure-sdk-for-media-services-extensions
在获取资产元数据下:
// The asset encoded with the Windows Media Services Encoder. Get a reference to it from the context.
IAsset asset = null;
// Get a SAS locator for the asset (make sure to create one first).
ILocator sasLocator = asset.Locators.Where(l => l.Type == LocatorType.Sas).First();
// Get one of the asset files.
IAssetFile assetFile = asset.AssetFiles.ToList().Where(af => af.Name.EndsWith(".mp4", StringComparison.OrdinalIgnoreCase)).First();
// Get the metadata for the asset file.
AssetFileMetadata manifestAssetFile = assetFile.GetMetadata(sasLocator);
TimeSpan videoDuration = manifestAssetFile.Duration;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2031 次 |
| 最近记录: |