Azure-正在为平滑流式处理准备内容



在我的编码Azure任务完成后,我有一堆ISMV/ISMA文件存储在Azure blob上。现在我希望它们可以用于平滑流式处理。我该怎么做?

我在互联网上找到的文章介绍了如何使用Adaptive Streaming Azure实用程序将ISMV文件从本地PC上传到Azure。但我的文件已经在Azure存储中,我不想下载它们并再次上传。

谁能给我个建议吗?

非常详细且技术准确的"如何:交付流媒体内容"将让您清楚地知道如何向用户交付平滑流媒体。

除此之外,您还可以在WaMediaWeb项目中探索Readme和Code:

public string GetSmoothStreamingOriginLocator(Models.Asset assetToStream)
{
// Get a reference to the manifest file from the collection 
// of streaming files in the asset. 
var manifestFile = assetToStream.MediaAsset.AssetFiles.Where(x => x.Name.EndsWith(".ism")).FirstOrDefault();
// Cast the reference to a true IFileInfo type. 
if (null == manifestFile)
{
return null;
}

// Create an 1-day readonly access policy. 
IAccessPolicy streamingPolicy = this.MediaService.MediaContext.AccessPolicies.Create("Streaming policy",
TimeSpan.FromDays(1),
AccessPermissions.Read);

// Create the origin locator. Set the start time as 5 minutes 
// before the present so that the locator can be accessed immediately 
// if there is clock skew between the client and server.
ILocator originLocator =
(from l in this.MediaService.MediaContext.Locators
where l.AssetId.Equals(assetToStream.MediaAsset.Id)
select l).FirstOrDefault();

if (originLocator == null)
{
originLocator = this.MediaService.MediaContext
.Locators.CreateLocator(LocatorType.OnDemandOrigin, assetToStream.MediaAsset,
streamingPolicy,
DateTime.UtcNow.AddMinutes(-5));
}
// Create a full URL to the manifest file. Use this for playback
// in streaming media clients. 
string urlForClientStreaming = originLocator.Path + manifestFile.Name + "/manifest";

// Display the full URL to the streaming manifest file.
Console.WriteLine("URL to manifest for client streaming: ");
Console.WriteLine(urlForClientStreaming);

return urlForClientStreaming;
}

更新

Azure Media Services当前不支持CDN。以前的SDK/neneneba API中曾经有一个AzureCdnOriginlocator,但现在已删除。因此,根据Azure Media Services的当前公共预览状态,您无法使用CDN。您只能使用OnDemandOrigin定位器进行平滑流式传输。

您还可以选择获取SAS定位器。但是,您不能使用SAS定位器来平滑流,因为它只会让您访问清单,而不是存储帐户上的其他文件(不同的比特率块)。

更新2

github上的我的代码是最新的API和SDK。

更新3

我错了!刚刚发现有关CDN的一些信息。因此,关于如何:启用CDN的文档是正确的,但有点不完整。

按照How To中描述的步骤进行操作。一旦您激活了CDN媒体服务帐户,通过所述的手动过程,您将能够使用您的CDN Endpoint。

话虽如此,OnDemandOrigin定位器将产生如下结果:

http://wamsamsreg001orig-hs.cloudapp.net/7f98142c-b513-40be-8d3c-5bf73fe442bb/2012-10-12-320.ism/manifest

您必须将wamsamsreg001orig-hs.cloudapp.net替换为Azure CDN端点,该端点类似于az02930.vo.msecnd.net,并获取流式传输清单的新URL:

http://az02930.vo.msecnd.net/7f98142c-b513-40be-8d3c-5bf73fe442bb/2012-10-12-320.ism/manifest

希望它有点清楚。您不能通过API和/或SDK自动访问CDN,您必须手动操作字符串,并且必须知道您的CDN端点。

这对我来说也是一件新鲜事。我必须更新我的代码——提供CDN的部分。

此外,请注意,创建定位器时,定位器不会立即可用。创建定位器后大约需要30-40秒。

你看到这篇关于如何使用Windows Azure Media Services的"如何操作"文章了吗?

媒体服务为Smooth streaming、Apple HTTP Live streaming和MP4格式提供流媒体源支持。

因此,您可以尝试使用此服务来实现您的目标。不能肯定,但对我来说,这部分对你来说可能很有趣:

如何:交付流媒体内容:

例如,您可以创建一个直接的URL,称为定位器,用于在Media Services源服务器上流式传输内容。如果您提供定位器,则Microsoft Silverlight等客户端应用程序可以直接播放流媒体内容。

MSDN上的Windows Azure媒体服务
Windows Azure媒体Services论坛

最新更新