# Licensing

By having any Visage Technologies Program, or part of it, installed or copied on your computer, you agree to the terms of the Visage Technologies AB Software License Agreement. If you do not agree with these terms, please entirely remove any Visage Technologies Programs from your computer.

This page focuses on technical issues such as obtaining and using the license key files. For detailed commercial conditions please contact Visage Technologies.

Applications developed using visage|SDK must be licensed in order to function. Licensing is based on License Key Files. A single License Key File is valid for one or more installations on one or more platforms (operating systems). The License Key File can be opened in a text editor (e.g. Windows Notepad or similar) in order to read the licensing information, but it is important not to change the file in any way as it would become invalid.

Note that you need to obtain a Licence Key File when you want to run any application using visage|SDK for HTML5 on your web server. Without a license key, applications will not work properly and appropriate warning message will be displayed.

## Obtaining the License Key File

For 30-day evaluation, simply send an email request to your Visage Technologies contact person and you will receive a License Key File by email.

If you are purchasing a license, your Visage Technologies contact person will deliver your License Key File by email based on your purchase order.

## Including the License Key File in your application

### a) Javascript application

Add License Key File to the folder on the server where HTML file is located (for example www\Samples\VirtualEyewearTryOn folder). In your application, you need to preload License Key File before VisageModule is loaded, and then call the initialization function in order to let the Application read the License Key File. Example how this is done is as follows in your application code:

Preloading License Key File:

        licenseName = "lic_web.vlc";
        licenseURL = "lic_web.vlc";

        VisageModule = {
            preRun: [function() {
                VisageModule.FS_createPreloadedFile('/', licenseName, licenseURL, true, false, function(){ },  function(){ alert("Loading License Failed!") });
            }],
            onRuntimeInitialized: onModuleInitialized
        }

Initializing License Key File:

        VisageModule.initializeLicenseManager("name-of-the-license-file.vlc");

        tracker = new VisageModule.VisageTracker("../../lib/Head_Tracker.cfg");

        faceData = new VisageModule.FaceData();

where "name-of-the-license-file.vlc" is the name of your License Key File located in the same folder as the main HTML file of application. Examples can be found in onModuleInitialized() function in gazeTracker.html (GazeTracker sample), ShowcaseDemo.html, recognitionWorker.js and analysisWorker.js (ShowcaseDemo sample) files or in eyewear.html (VirtualEyewearTryOn sample) file.

### b) Unity application

Add License Key File to the Assets/StreamingAssets folder in the Unity application. The License Key File needs to be preloaded in Awake() function, and then initialized in Start() function in order to let the Application read the License Key File. Example how this is done is as follows in your Unity application code:

Preloading License Key File:

    	VisageTrackerNative._preloadFile(Application.streamingAssetsPath + "/Visage Tracker/" + LicenseString.licenseString);

Initializing License Key File:

    	licenseFilePath = "";

    	...

    	VisageTrackerNative._initializeLicense(licenseFilePath + LicenseString.licenseString);

#### VisageTrackerUnityDemo Sample

In the VisageTrackerUnityDemo sample project the license is expected to be placed in the correct folder in the Unity project: Assets/StreamingAssets/Visage Tracker.

Also, the name of the License Key File (name-of-the-license-file.vlc) needs be set to licenseString variable in script LicenseString.cs.

## Including multiple License Key Files in your application

### a) Javascript application

Add License Key Files to the folder on the server where HTML file is located (for example www\Samples\ShowcaseDemo folder). To include multiple License Key Files simply preload each License Key File before VisageModule is loaded, then call the initialization function for each License Key File. This is done as follows in your application code:

Preloading License Key File:

        licenseName = "name-of-first-license-file";
        licenseURL = "name-of-first-license-file";
        licenseName_2 = "name-of-second-license-file.vlc";
        licenseURL_2 = "name-of-second-license-file.vlc";

        VisageModule = {
            preRun: [function() {
                VisageModule.FS_createPreloadedFile('/', licenseName, licenseURL, true, false, function(){ },  function(){ alert("Loading License Failed!") });
                VisageModule.FS_createPreloadedFile('/', licenseName_2, licenseURL_2, true, false, function(){ },  function(){ alert("Loading License Failed!") });
            }],
            onRuntimeInitialized: onModuleInitialized
        }

Initializing License Key File:

        VisageModule.initializeLicenseManager("licenseName");
        VisageModule.initializeLicenseManager("licenseName_2");

        tracker = new VisageModule.VisageTracker("../../lib/Head_Tracker.cfg");

        faceData = new VisageModule.FaceData();

where "name-of-first-license-file.vlc" and "name-of-second-license-file.vlc" are the names of your License Key Files located in the same folder as the main HTML file of application. Examples can be found in onModuleInitialized() function in gazeTracker.html (GazeTracker sample), ShowcaseDemo.html, recognitionWorker.js and analysisWorker.js (ShowcaseDemo sample) files or in eyewear.html (VirtualEyewearTryOn sample) file.

### b) Unity application

Add License Key Files to the Assets/StreamingAssets folder in the Unity application. To include multiple License Key Files, each one needs to be preloaded in Awake() function, and then initialized in Start() function in order to let the Application read each License Key File. Example how this is done is as follows in your Unity application code:

Preloading License Key File:

    	VisageTrackerNative._preloadFile(Application.streamingAssetsPath + "/Visage Tracker/" + LicenseString.licenseString);
    	VisageTrackerNative._preloadFile(Application.streamingAssetsPath + "/Visage Tracker/" + LicenseString.licenseString2);

To initialize multiple License Key Files simply initialize each License Key File. This is done as follows in your application:

    	licenseFilePath = ""; //same license file path if License Key Files are in the same folder

    	...

    	VisageTrackerNative._initializeLicense(licenseFilePath + LicenseString.licenseString);
    	VisageTrackerNative._initializeLicense(licenseFilePath + LicenseString.licenseString2);

#### VisageTrackerUnityDemo Sample

In the VisageTrackerUnityDemo sample project the licenses are expected to be placed in the correct folder in the Unity project: Assets/StreamingAssets/Visage Tracker.

Also, each licenseString variable in script LicenseString.cs needs to be set to name of the each License Key File name (name-of-the-license-file.vlc).