Jump to content

Viveport DRM Guide


Recommended Posts

Viveport DRM Guide

Option 1. - Use DRM Wrapper
Option 2. - Use Viveport SDK


FAQ
* How to test DRM?
Disable one of the DRM requirements (disable internet, log out, close viveport)

* How to use PC DRM wrapper?
On the Viveport Developer Console, go to your title submission > VIVEPORT Listing > DRM section.
Check the "Wrapper-based DRM" option.
Upload a build to the store (beta or production release).
Build will be automatically DRM wrapped during submission.

* How to use Mobile DRM wrapper?

Refer to the "Wrapper-based DRM" section of the submission guide:

https://developer.vive.com/resources/viveport/store-guide/store-submission-guide/english/submitting-your-mobile-vr-content/viveport-listing/

* Does the Viveport DRM Wrapper work with Unity/Unreal games?
Yes.

* When should an app/game use the DRM Wrapper?
If the game doesn't need any store SDK functionality (leaderboards, achievements, IAP, DLC, etc.).

* When should an app/game use the Viveport SDK?
If the game needs any Viveport store SDK functionality (leaderboards, achievements, IAP, DLC, etc.).

* Can a title be submitted to Viveport that uses other store SDKs, such as Oculus or Steamworks?
No, please remove other store SDKs such as Oculus or Steamworks.

* Is DRM active in Beta releases?
Yes, if it has been DRM wrapped or the Viveport SDK DRM has been implemented.

* Will lack of DRM fail a Viveport submission for Production release?
Yes, DRM is required for store submission unless explicitly communicated by the developer via email to developer support.


NOTE (MOBILE ONLY): For Viveport Mobile submissions (Using the VIVE Wave SDK) there is a known bug where Unreal apps cannot be submitted with the DRM wrapper. Please use the Viveport SDK integration for Unreal + Wave apps.

NOTE: PC submissions larger than 4GB may have issues with DRM wrapper. Suggest to use 7-zip software to zip the package and set Compression method to Deflated64.


DRM Requirements:
Viveport app open
Viveport account logged in
Internet connection
DRM Wrapper or Viveport SDK, API "Init()" (initialization) success & "GetLicense()" success


Documentation
https://developer.vive.com/resources/documentation/viveport-sdk/apis/drm-api/

 

Unity Sample Code

using System.Collections;
using UnityEngine;
using Viveport;

// Viveport DRM Documentation:
// https://developer.vive.com/resources/documentation/viveport-sdk/apis/drm-api/

// NOTE: To use Unity functions such as Application.Quit within callback functions requires running on the main thread.
// Please attach 'MainThreadDispatcher.cs' to an object in your scene
// https://developer.vive.com/resources/documentation/viveport-sdk/integration-with-viveport-sdk/for-unity-developers/using-the-unity-main-thread-dispatcher-script/

[RequireComponent(typeof(MainThreadDispatcher))]
public class ViveportDRM : MonoBehaviour
{
    // Get a VIVEPORT ID and VIVEPORT Key from the VIVEPORT Developer Console:
    // https://developer.viveport.com/console/titles
    // https://developer.vive.com/resources/documentation/viveport-sdk/overview/about-viveport-id-and-viveport-key/

    static string VIVEPORT_ID = "VIVEPORT ID of the content";           // replace with developer VIVEPORT ID
    static string VIVEPORT_KEY = "VIVEPORT Key of the content";         // replace with developer VIVEPORT Key

    private const int SUCCESS = 0;
    private static bool bInitComplete = false;

    void Start()
    {
        Api.Init(InitStatusHandler, VIVEPORT_ID);       // initialize VIVEPORT platform
        Invoke("CheckInitStatus", 10);                  // check that VIVEPORT Init succeeded
    }

    void OnDestroy()
    {
        Api.Shutdown(ShutdownHandler);
    }

    private static void InitStatusHandler(int nResult)          // The callback of Api.init()
    {
        if (nResult == SUCCESS)
        {
            Debug.Log("VIVEPORT init pass");
            Api.GetLicense(new MyLicenseChecker(), VIVEPORT_ID, VIVEPORT_KEY);    // the response of Api.Init() is success, continue using Api.GetLicense() API
            bInitComplete = true;
        }

        else
        {
            Debug.Log("VIVEPORT init fail");
            Application.Quit();
            return;                                             // the response of Api.Init() is fail
        }
    }

    private static void ShutdownHandler(int nResult)            // The callback of Api.Shutdown()
    {
        if (nResult == SUCCESS)
        {
            Application.Quit();                                 // the response of Api.Shutdown() is success, close the content
        }

        else
        {
            return;                                             // the response of Api.Shutdown() is fail
        }
    }

    private void CheckInitStatus()
    {
        if (!bInitComplete)
        {
            Debug.LogWarning("Viveport init check fail");     // init requires VIVEPORT app installed and online connection
            Application.Quit();
        }
        else
            Debug.Log("Viveport init check pass");
    }

    class MyLicenseChecker : Api.LicenseChecker
    {
        public override void OnSuccess(long issueTime, long expirationTime, int latestVersion, bool updateRequired)
        {
            // the response of Api.GetLicense() is DRM success, user is allowed to use the content and continue with content flow
            Debug.Log("Viveport DRM pass");
            Debug.Log("issueTime: " + issueTime);
            Debug.Log("expirationTime: " + expirationTime);
            MainThreadDispatcher.Instance().Enqueue(SuccessAction());
        }

        public override void OnFailure(int errorCode, string errorMessage)
        {
            // the response of Api.GetLicense() is DRM fail, user is not allowed to use the content
            MainThreadDispatcher.Instance().Enqueue(FailAction());
        }

        // Use these methods to call Unity functions from the API callbacks on the main thread
        IEnumerator SuccessAction()
        {
            // todo: continue loading game or load next scene
            Debug.LogWarning("Viveport DRM Success");
            yield return null;
        }

        IEnumerator FailAction()
        {
            Debug.LogWarning("Viveport DRM Fail: Quitting");
            Application.Quit();
            yield return null;
        }
    }
}

 

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...