0
votes

I am trying to get on demand streaming of videos setup with Azure Media Services.

So far I can upload, transcode and stream videos using an "OnDemandOrigin" locator.

My current understanding, based on the documentation I have read is that I should just be able to activate the CDN and use the same URL to then access the streaming content via the CDN.

Unfortunately, I am getting 404's when using the same locator URL with the CDN enabled and I don't understand why.

The code I am using to create the locator is as follows:

var asset = Context.Assets.Where(a => a.Id == assetId).FirstOrDefault();
if (asset == null)
{
    throw new ArgumentException("Could not find assetId: " + assetId);
}

var accessPolicy = Context.AccessPolicies.Create(string.Format("View '{0}' - {1:yyyy-MM-ddTHH:mm:ssZ}", asset.Id,  DateTime.UtcNow), sasDuration, AccessPermissions.Read);
var locator = Context.Locators.CreateLocator(LocatorType.OnDemandOrigin, asset, accessPolicy, DateTime.UtcNow.AddMinutes(-5));

var streamingSasUrl = string.Format("{0}/{1}/{2}/manifest", locator.BaseUri.Remove(0, 5), locator.ContentAccessComponent, asset.GetManifestAssetFile().Name);

Can anybody point me in the right direction?

1

1 Answers

0
votes

Are you enabling CDN using Media services or manually? Your locator code looks good. Can you please share a example URL which we can investigate?