Question

After my encoding Azure task is done, I have a bunch of ISMV/ISMA files stored onto Azure blob. Now I want them to be available for Smooth Streaming. How can I do that?

The articles I found in Internet say how to upload ISMV files from local PC onto Azure using Adaptive Streaming Azure utility. But my files are already on an Azure storage and I don't want to download them and upload again.

Could anyone please advise?

Was it helpful?

Solution

The very detailed and technically accurate How to: Deliver Streaming Content will give you a crystal clear idea what to do in order to deliver the Smooth Streams to your users.

Other than that, you can also explore the Readme and Code in the WaMediaWeb project:

    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;
    }

UPDATE

CDN is not currently supported in Azure Media Services. There used to be an AzureCdnOriginlocator in the previous SDK/API, but that is now removed. So with current public preview state of Azure Media Services you can't use CDN. You can only use the OnDemandOrigin Locator for smooth streaming.

You also have the option to get a SAS locator. However you can't use the SAS Locator for smooth streams, because it will just give you access to the manifest and not the rest of the files (different bitrate chunks) on the storage account.

UPDATE 2

Mine code on github is up-to-date with the latest (to date) API and SDK.

UPDATE 3

I was in mistake! Just discovered something about the CDN. So, the documentation on How to: Enable CDN is correct, but a bit incomplete.

Follow the steps described in that How To. Once you activate your Media Services Account for CDN, through the manual process described, you will be able to use your CDN Endpoint.

Having said that, OnDemandOrigin locator will result into something like:

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

You have to replace the wamsamsreg001orig-hs.cloudapp.net with your Azure CDN endpoint, which would be something like az02930.vo.msecnd.net and get that new URL for the streaming manifest:

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

Hope it is a bit clear. You can't the CDN automatically via the API and/or SDK, you have to do manual string manipulation and you have to know your CDN endpoint.

It is something new for me also. I have to update my code - the part with providing the CDN.

Also, please pay attention that Locators are not immediately available when they are created. It is about 30-40 seconds after creation when the locator will be available.

OTHER TIPS

Did you saw this How-To article about How to Use Windows Azure Media Services?

Media Services provide streaming origin support for Smooth Streaming, Apple HTTP Live Streaming, and MP4 formats.

So you can try to use this services to achieve your goal. Can't say for sure, but as for me, this part can be interesting for you:

How to: Deliver streaming content:

For example, you can create a direct URL, called a locator, to streaming content on a Media Services origin server. Client applications such as Microsoft Silverlight can play the streaming content directly if you provide the locator.

Windows Azure Media Services on MSDN
Windows Azure Media Services Forums

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top