2

在我的 Azure 编码任务完成后,我将一堆 ISMV/ISMA 文件存储到 Azure blob 中。现在我希望它们可用于平滑流式传输。我怎样才能做到这一点?

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

有人可以建议吗?

4

2 回答 2

3

非常详细且技术准确的“如何:提供流媒体内容”将让您清楚地了解如何为您的用户提供流畅的流媒体。

除此之外,您还可以浏览WaMediaWeb 项目中的自述文件代码:

    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 媒体服务目前不支持CDN 。以前的 SDK/API 中曾经有一个 AzureCdnOriginlocator,但现在已删除。因此,在 Azure 媒体服务的当前公共预览状态下,您无法使用 CDN。您只能使用 OnDemandOrigin Locator 进行流畅的流式传输。

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

更新 2

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

更新 3

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

请按照该操作方法中描述的步骤进行操作。激活 CDN 的媒体服务帐户后,通过所述的手动过程,您将能够使用您的 CDN 端点。

话虽如此, 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 秒后,定位器将可用。

于 2012-12-06T10:43:03.907 回答
0

您是否看过这篇关于如何使用 Windows Azure 媒体服务的操作指南文章?

媒体服务为平滑流、Apple HTTP 实时流和 MP4 格式提供流源支持。

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

如何:提供流媒体内容

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

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

于 2012-12-06T10:42:25.623 回答