1
votes

I am trying to use OSM Player as a Video Player for a video that is hosted on Windows Azure Media Services. Unfortunately, it seems that OSM Player is unable to play these files.

Here are the steps that I took:

  1. Set up Media Services within the Windows Azure Management Console.
  2. From the "Content" tab, uploaded a video file. The exact video file can be found here: https://archive.org/download/Windows7WildlifeSampleVideo/Wildlife_512kb.mp4
  3. Upon successful upload, I clicked on the video and then clicked "Encode"
  4. From the Encoding options, I chose the Common Preset: "Playback via HTML5 (IE/Chrome/Safari)".
  5. I then clicked the "checkbox".
  6. Upon successful encoding, I clicked the publish button. The generated URL looked something like this: https://[xxx].blob.core.windows.net/[xxx]/Wildlife_512kb_H264_4500kbps_AAC_und_ch2_128kbps.mp4?sv=2012-02-12&st=[xxx]&se=[xxx]&sr=c&si=[xxx]&sig=[xxx]

Potentially sensitive parts of the URL have been replaced with [xxx].

When I try to use OSM Player with this video, the video never loads. Has anyone gotten OSM Player to work with videos hosted on Windows Azure Media Services? If so, are there any special settings that need to be used for Encoding or Playback?

Thanks!

1

1 Answers

1
votes

"Playback via HTML5 (IE/Chrome/Safari)" option in portal maps to Azure Media preset "H264 Broadband 720p". (For available list of system presents see http://msdn.microsoft.com/en-us/library/azure/dn619392.aspx). This preset produces single bitrate mp4 file, manifests file with extension *.ism and 2 xml files with metadata.

Url which you listed is url to asset container and not url to a mp4 file you need to use. There are two ways you can play asset through osm player: pointing to Azure Storage (SAS Locator) and pointing to Azure Media Services Origin server. Example below demonstrate how to construct uris for both scenarios. Uri constructions has been simplified in sdk extensions methods. See locator extensions in https://github.com/Azure/azure-sdk-for-media-services-extensions.

        //Fetching existing job
        IJob job = _mediaContext.Jobs.Where(c => c.Id == "nb:jid:UUID:29e033f5-402d-bc47-8f8d-56d83ff6915c").FirstOrDefault();
        //Assume it has 1 output asset
        IAsset asset = job.OutputMediaAssets[0];

        //Access policy to publish asset for 5 days
        const string days = "5days";
        IAccessPolicy policy  = _mediaContext.AccessPolicies.Where(c=>c.Name == days).FirstOrDefault();

        //If not exists we creating access policy
        if (policy == null)
        {
            policy =_mediaContext.AccessPolicies.Create(days, TimeSpan.FromDays(5), AccessPermissions.Read | AccessPermissions.List);
        }

        //Remove previously used locators
        _mediaContext.Locators.ToList().ForEach(c=>c.Delete());

        //Creating Sas Locator. Users directly access asset through Azure storage
        ILocator sasLocator = _mediaContext.Locators.CreateLocator(LocatorType.Sas, asset, policy);
        IAssetFile mp4File = asset.AssetFiles.Where(c => c.Name.Contains(".mp4")).FirstOrDefault();
        string srcUri = sasLocator.BaseUri + "/" + mp4File.Name + sasLocator.ContentAccessComponent;

        //Creating OnDemandOrigin Locator. Users access assets through origin server
        ILocator ondemandOriginLocator = _mediaContext.Locators.CreateLocator(LocatorType.OnDemandOrigin, asset, policy);
        IAssetFile ismFile = asset.AssetFiles.Where(c => c.Name.Contains(".ism")).FirstOrDefault();
        string ondemandUri = ondemandOriginLocator.Path + ismFile.Name +"/Manifest";