Skip to content

Instantly share code, notes, and snippets.

@nmackenzie
Created October 1, 2013 05:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nmackenzie/6774384 to your computer and use it in GitHub Desktop.
Save nmackenzie/6774384 to your computer and use it in GitHub Desktop.
private String GetStreamingUrl(IJob job)
{
IAsset assetToStream = job.OutputMediaAssets[0];
var theManifest =
from f in assetToStream.AssetFiles
where f.Name.EndsWith(".ism")
select f;
IAssetFile manifestFile = theManifest.First();
IAccessPolicy sharedAccessPolicy = context.AccessPolicies.Create(
"StreamFor7DaysPolicy",
TimeSpan.FromDays(7),
AccessPermissions.Read);
ILocator streamingMediaLocator = context.Locators.CreateLocator(
LocatorType.OnDemandOrigin,
assetToStream,
sharedAccessPolicy,
DateTime.UtcNow.AddMinutes(-5)); // In case of clock drift
string streamingUrl = String.Format("{0}{1}/manifest",
streamingMediaLocator.Path,
manifestFile.Name);
return streamingUrl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment