DRM API

Introduction

  • The VIVEPORT DRM API provides an API to verify if the current user is allowed to launch the content.

Function Spec

DRM API

void GetLicense(LicenseChecker callback, string viveportId, string viveportKey);
Name Type Description
callback LicenseChecker Callback function
viveportId string entity’s VIVEPORT ID
viveportKey string entity’s VIVEPORT Key

Details

No matter what the content is, paid or free, user can the DRM API to know if they are allowed to launch it or not.

How to get a VIVEPORT ID and VIVEPORT key

  • Please correctly paste the VIVEPORT ID and VIVEPORT KEY of the content into your code snipped through Copy VIVEPORT ID and Copy VIVEPORT KEY buttons on the Manage -> VIVEPORT Listing page of developer console.

    _images/AppID.png

Error code

  • It is recommended to follow the trouble shooting first while getting such an error code like following.
Error Code Description & Trouble Shooting
0 Success
50001 Invalid account ID/VIVEPORT ID/VIVEPORT key
50004 Cannot connect server
80002 GetLicense failed because user does not login VIVEPORT

Attention

For WAVE developers, you’ll need to modify the AndroidManifest.xml to have the permission of com.viveport.CHECK_LICENSE , details .

Best Practice

Attention

  • Get a VIVEPORT ID and VIVEPORT Key from the VIVEPORT Developer Console , and then paste them to your content. Please refer to here .
  • Use Top Level API - Viveport.Api.Init to initialize VIVEPORT platform. For Unity developer, it is usually used in MonoBehaviour “Start()”.
  • Use DRM API - Viveport.Api.GetLicense to verify whether current user is allowed to launch the content. It is usually used to check the user’s authentication. Show an error message and close the content if you receive the error code from the API.
  • Use Top Level API - Viveport.Api.Shutdown to shutdown and release VIVEPORT SDK resources. For an Unity developer, it is usually used in MonoBehaviour “OnDestroy()” or before Application.Quit().

Before testing

  • Go to VIVEPORT website and download VIVEPORT desktop application.

    _images/Viveport_home.png
  • Install the downloaded file ViveportSetup.exe and follow the step by step instructions to complete the setup process.

  • On the PC desktop, a VIVEPORT icon will appear. Double click to launch it and sign in as your developer account.

    _images/viveport_desktop_icon.png
  • Sign in by using a developer account. A developer account is allowed to launch content by default. So, the content can be launched successfully.

  • Sign in by using an another user account, then launch a content. Because the content is not owned by the user, it will go the the fail case of Viveport.Api.GetLicense and go through the error handling flow.

Important

You can also see the Error Codes and Trouble Shooting pages to know what to do when you encounter problems using the VIVEPORT SDK.

Sample Code

Notes

1.For Wave content

  • In AndroidManifest.xml , declaring a <uses-permission android:name=”com.viveport.CHECK_LICENSE” /> element as a child of <manifest> .

Example:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" ...">
<... />
<uses-permission android:name="com.viveport.CHECK_LICENSE" />
<... />
</manifest>