How to set license string in AVBlocks
This post assumes that you are using AVBlocks for .NET and you have purchased a license from the License Management site.
When you license a Primo Software product you usually get a license file in the email. The license file is basically a signed XML string that describes the products and features you have licensed. Then you have to provide the license to AVBlocks with the Library.SetLicense method.
Here is a code snippet in C#:
const string license = @"<primoSoftware> <license version='1.0'> <token>abcdefghijklmnop</token> <revision>1</revision> <issueDate>2013-05-23</issueDate> <expireDate>2014-05-24</expireDate> <updateTime>2013-05-23 21:02:44</updateTime> <item id='avb-win'> <product>avb</product> <feature id='h264-enc' /> <feature id='pcm' /> </item> <signature>abcd-long-signature-string-here</signature> </license> </primoSoftware>"; Library.SetLicense(license);
The license above is for AVBlocks for Windows (‘avb-win’) and includes the [AVC / H.264 Encoder] (‘h264-enc’) and [PCM Audio] (‘pcm’) features.
Then the following calls should return true for the license above:
Library.IsLicensed(null, null); Library.IsLicensed(null, "h264-enc"); Library.IsLicensed(null, "pcm"); Library.IsLicensed("avb", "h264-enc"); Library.IsLicensed("avb", "pcm");
Library.SetLicenseon any of the AVBlocks Demo libraries will fail. The Demo version cannot be licensed. If you downloaded AVBlocks from www.avblocks.com then you have the Demo product. You need to get your AVBlocks copy from the Downloads section of the License Manager site.
- You should be careful when formatting the license XML as it may become invalid.
Here are the rules:
- It’s OK to reformat the blank space between the xml elements in the license (spaces, new lines) the way you wish.
- It’s also OK to substitute the double quotes with single quotes (as shown in the example above), otherwise you need to escape the double quotes.
- It’s NOT OK to reorder elements or change the letter case.