You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sample for content key policy operations with MK.IO SDK
using MK.IO;using MK.IO.Models;// **********************// MK.IO Client creation// **********************varclient=new MKIOClient("mkiosubscriptionname","mkiotoken");// ******************************// content key policy operations// ******************************try{ck=await client.ContentKeyPolicies.Get("testpolcreate");await client.ContentKeyPolicies.DeleteAsync("testpolcreate");}catch{}// generate a symmetric key for the content key policyvarkey= GenerateSymKeyAsBase64();// create a new content key policyvarnewpol= client.ContentKeyPolicies.Create("testpolcreate",new ContentKeyPolicyProperties("My description",newList<ContentKeyPolicyOption>(){new ContentKeyPolicyOption("option1",new ContentKeyPolicyConfigurationWidevine("{}"),new ContentKeyPolicyTokenRestriction("issuer","audience",
RestrictionTokenType.Jwt,new ContentKeyPolicySymmetricTokenKey(key)))}));// ******************************// Streaming locator operations// ******************************// list all locators in the subscriptionvarmklocators= client.StreamingLocators.List();// list all locators of a specified assetvarmklocatorsasset= client.Assets.ListStreamingLocators("myassetname");varmklocator= client.StreamingLocators.Create(
MKIOClient.GenerateUniqueName("locator"),new StreamingLocatorProperties
{AssetName="copy-ef2058b692-copy",StreamingPolicyName= PredefinedStreamingPolicy.ClearStreamingOnly
});varmklocator2= client.StreamingLocators.Get(mklocator.Name);// get streaming paths for a locatorvarpathsl= client.StreamingLocators.ListUrlPaths(mklocator.Name);// delete a locator
client.StreamingLocators.Delete(mklocator.Name);privatestaticstringGenerateSymKeyAsBase64(){byte[]TokenSigningKey=newbyte[40];varrng= RandomNumberGenerator.Create();
rng.GetBytes(TokenSigningKey);return Convert.ToBase64String(TokenSigningKey);}