Sunday, 15 May 2011

smooth streaming - Azure Media Services Shared Access Policy limitations -



smooth streaming - Azure Media Services Shared Access Policy limitations -

i'm trying create time-limited url's smooth streaming of media stored in azure media services.

i working against code supplied here. windows azure smooth streaming example

i upload video file new asset. encode video file using azure media service encoding preset "h264 adaptive bitrate mp4 set 720p". resulting encoded asset, effort create streaming url creating access policy , locator, utilize generate url used streaming.

here code:

string urlforclientstreaming = ""; iassetfile manifestfile = (from f in asset.assetfiles f.name.endswith(".ism") select f).firstordefault(); if (manifestfile != null) { // create 1 hr readonly access policy. iaccesspolicy policy = _mediacontext.accesspolicies.create("streaming policy", timespan.fromhours(1), accesspermissions.read); // create locator streaming content on origin. ilocator originlocator = _mediacontext.locators.createlocator(locatortype.ondemandorigin, asset, policy, datetime.utcnow.addminutes(-5)); urlforclientstreaming = originlocator.path + manifestfile.name + "/manifest"; if (contenttype == mediacontenttype.hls) urlforclientstreaming = string.format("{0}{1}", urlforclientstreaming, "(format=m3u8-aapl)"); } homecoming urlforclientstreaming;

this works great. until 6th time execute code against same asset. receive error:

"server not back upwards setting more 5 shared access policy identifiers on single container."

so, that's fine. don't need create new accesspolicy everytime, can reuse 1 i've created previously, build locator using same policy. however, then, error 5 shared access policies on single container.

here new code creates locator same accesspolicy used previously:

string urlforclientstreaming = ""; iassetfile manifestfile = (from f in asset.assetfiles f.name.endswith(".ism") select f).firstordefault(); if (manifestfile != null) { // create 1 hr readonly access policy iaccesspolicy accesspolicy = null; accesspolicy = (from p in _mediacontext.accesspolicies p.name == "myaccesspolicy" select p).firstordefault(); if (accesspolicy == null) { accesspolicy = _mediacontext.accesspolicies.create("myaccesspolicy", timespan.fromhours(1), accesspermissions.read); } // create locator streaming content on origin. ilocator originlocator = _mediacontext.locators.createlocator(locatortype.ondemandorigin, asset, policy, datetime.utcnow.addminutes(-5)); urlforclientstreaming = originlocator.path + manifestfile.name + "/manifest"; if (contenttype == mediacontenttype.hls) urlforclientstreaming = string.format("{0}{1}", urlforclientstreaming, "(format=m3u8-aapl)"); } homecoming urlforclientstreaming;

i don't understand why it's saying i've created 5 shared access policies. in case of sec block of code, ever create 1 access policy. can verify there ever 1 accesspolicy viewing content of _mediacontext.accesspolicies, there 1 access policy in list.

at point have many users requesting access same asset. url's provided these clients need time limited per our clients requirements.

is not appropriate means create url smooth streaming of asset?

now azure media services content protection feature, encrypt media file either aes or playready, generate long-lived locator. @ same time, set token-authorization policy content key, token duration set short-period of time (enough player retrieve content key). way command content access. more information, refer blog: http://azure.microsoft.com/blog/2014/09/10/announcing-public-availability-of-azure-media-services-content-protection-services/

azure smooth-streaming azure-media-services

No comments:

Post a Comment