Skip to content

ContentProtection API

Version: 1.0.0

Status: ⚫⚪⚪

ContentProtection interface for Thunder framework.

(Defined with IContentProtection in IContentProtection.h)

Table of Contents

Introduction

Scope

This document describes purpose and functionality of the ContentProtection interface (version 1.0.0). It includes detailed specification about its methods provided and notifications sent.

Case Sensitivity

All identifiers of the interfaces described in this document are case-sensitive. Thus, unless stated otherwise, all keywords, entities, properties, relations and actions should be treated as such.

Acronyms, Abbreviations and Terms

The table below provides and overview of acronyms used in this document and their definitions.

Acronym Description
API Application Programming Interface
HTTP Hypertext Transfer Protocol
JSON JavaScript Object Notation; a data interchange format
JSON-RPC A remote procedure call protocol encoded in JSON

The table below provides and overview of terms and abbreviations used in this document and their definitions.

Term Description
callsign The name given to an instance of a plugin. One plugin can be instantiated multiple times, but each instance the instance name, callsign, must be unique.

References

Ref ID Description
HTTP HTTP specification
JSON-RPC JSON-RPC 2.0 specification
JSON JSON specification
Thunder Thunder API Reference

Description

ContentProtection JSON-RPC interface.

Methods

The following methods are provided by the ContentProtection interface:

Built-in methods:

Method Description
exists Checks if a JSON-RPC method or property exists
register Registers for an asynchronous JSON-RPC notification
unregister Unregisters from an asynchronous JSON-RPC notification

ContentProtection interface methods:

Method Description
openDrmSession / openDrmSession
setDrmSessionState / setDrmSessionState
updateDrmSession / updateDrmSession
closeDrmSession / closeDrmSession
showWatermark / showWatermark
setPlaybackPosition / setPlaybackPosition

exists method

Checks if a JSON-RPC method or property exists.

Description

This method will return True for the following methods/properties: exists, register, unregister, openDrmSession, setDrmSessionState, updateDrmSession, closeDrmSession, showWatermark, setPlaybackPosition.

Parameters

Name Type M/O Description
params object mandatory ...
params.method string mandatory Name of the method or property to look up

Result

Name Type M/O Description
result boolean mandatory Denotes if the method exists or not

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "<callsign>.1.exists",
  "params": {
    "method": "methodName"
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": false
}

register method

Registers for an asynchronous JSON-RPC notification.

Description

This method supports the following event names: watermarkStatusChanged.

Parameters

Name Type M/O Description
params object mandatory ...
params.event string mandatory Name of the notification to register for
params.id string mandatory Client identifier

Result

Name Type M/O Description
result null mandatory Always null

Errors

Message Description
ERROR_FAILED_REGISTERED Failed to register for the notification (e.g. already registered)

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "<callsign>.1.register",
  "params": {
    "event": "eventName",
    "id": "myapp"
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": null
}

unregister method

Unregisters from an asynchronous JSON-RPC notification.

Description

This method supports the following event names: watermarkStatusChanged.

Parameters

Name Type M/O Description
params object mandatory ...
params.event string mandatory Name of the notification to register for
params.id string mandatory Client identifier

Result

Name Type M/O Description
result null mandatory Always null

Errors

Message Description
ERROR_FAILED_UNREGISTERED Failed to unregister from the notification (e.g. not yet registered)

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "<callsign>.1.unregister",
  "params": {
    "event": "eventName",
    "id": "myapp"
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": null
}

openDrmSession method

openDrmSession is an alternative name for this method.

Parameters

Name Type M/O Description
params object mandatory ...
params.clientId string mandatory Client that establishes the playback session
params.appId string mandatory Application requesting the new watermarking session
params.keySystem string mandatory ... (must be one of the following: clearkey, playready, widevine)
params.licenseRequest string mandatory Base64-encoded DRM license request
params.initData string mandatory Video platform specific init data

Result

Name Type M/O Description
result object mandatory ...
result.sessionId integer mandatory Generated by SecManager to track sessions
result.openSessionResponse string mandatory Video platform specific response data

Errors

Message Description
21002 Invalid aspect dimension
21003 Invalid key system
21004 Invalid license request
21005 Invalid content metadata
21006 Invalid media usage
21007 Invalid access token
21008 Invalid access attributes
21009 Invalid session id
21012 Invalid client id
21014 Invalid watermarking system
21015 Invalid content attributes
22001 DRM general failure
22003 DRM license timeout
22004 DRM license network failure
22008 DRM access token expired
22011 DRM MAC token not provisioned
22012 DRM memory allocation error
22013 DRM SecAPI usage failure
22016 DRM entitlement error
23001 Watermark general failure
23003 Watermark request timeout
23012 Watermark memory allocation error
23014 Watermark perceptibility error

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "<callsign>.1.openDrmSession",
  "params": {
    "clientId": "com.comcast.vipa:1",
    "appId": "...",
    "keySystem": "playready",
    "licenseRequest": "...",
    "initData": "{\"sessionConfiguration\":{\"distributedTraceId\":\"...\"},\"accessToken\":\"...\",\"contentMetadata\":\"...\"}"
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": {
    "sessionId": 930762523,
    "openSessionResponse": "{\"license\":\"...\",\"refreshDuration\":0}"
  }
}

setDrmSessionState method

setDrmSessionState is an alternative name for this method.

Parameters

Name Type M/O Description
params object mandatory ...
params.sessionId integer mandatory Sec manager generated playback session id
params.sessionState string mandatory ... (must be one of the following: active, inactive)

Result

Name Type M/O Description
result null mandatory Always null

Errors

Message Description
21009 Invalid session id

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "<callsign>.1.setDrmSessionState",
  "params": {
    "sessionId": 930762523,
    "sessionState": "inactive"
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": null
}

updateDrmSession method

updateDrmSession is an alternative name for this method.

Parameters

Name Type M/O Description
params object mandatory ...
params.sessionId integer mandatory Sec manager generated playback session id
params.licenseRequest string mandatory Base64-encoded DRM license request
params.initData string mandatory Video platform specific init data

Result

Name Type M/O Description
result string mandatory Video platform specific response data

Errors

Message Description
21002 Invalid aspect dimension
21003 Invalid key system
21004 Invalid license request
21005 Invalid content metadata
21006 Invalid media usage
21007 Invalid access token
21008 Invalid access attributes
21009 Invalid session id
21012 Invalid client id
21014 Invalid watermarking system
21015 Invalid content attributes
22001 DRM general failure
22003 DRM license timeout
22004 DRM license network failure
22008 DRM access token expired
22011 DRM MAC token not provisioned
22012 DRM memory allocation error
22013 DRM SecAPI usage failure
22016 DRM entitlement error
23001 Watermark general failure
23003 Watermark request timeout
23012 Watermark memory allocation error
23014 Watermark perceptibility error

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "<callsign>.1.updateDrmSession",
  "params": {
    "sessionId": 930762523,
    "licenseRequest": "...",
    "initData": "{\"sessionConfiguration\":{\"distributedTraceId\":\"...\"},\"accessToken\":\"...\",\"contentMetadata\":\"...\"}"
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": "{\"license\":\"...\",\"refreshDuration\":0}"
}

closeDrmSession method

closeDrmSession is an alternative name for this method.

Parameters

Name Type M/O Description
params object mandatory ...
params.sessionId integer mandatory Sec manager generated playback session id

Result

Name Type M/O Description
result string mandatory Video platform specific response data

Errors

Message Description
21009 Invalid session id
21012 Invalid client id

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "<callsign>.1.closeDrmSession",
  "params": {
    "sessionId": 930762523
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": "..."
}

showWatermark method

showWatermark is an alternative name for this method.

Parameters

Name Type M/O Description
params object mandatory ...
params.sessionId integer mandatory Id returned on a call to openDrmSession
params.show boolean mandatory True when watermark has to be presented
params.opacityLevel integer mandatory ...
Value must be <= 100

Result

Name Type M/O Description
result null mandatory Always null

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "<callsign>.1.showWatermark",
  "params": {
    "sessionId": 930762523,
    "show": false,
    "opacityLevel": 0
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": null
}

setPlaybackPosition method

setPlaybackPosition is an alternative name for this method.

Parameters

Name Type M/O Description
params object mandatory ...
params.sessionId integer mandatory Sec manager generated playback session id
params.speed integer mandatory Current playback speed
params.position integer mandatory Current playback position

Result

Name Type M/O Description
result null mandatory Always null

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "<callsign>.1.setPlaybackPosition",
  "params": {
    "sessionId": 930762523,
    "speed": 0,
    "position": 0
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": null
}

Notifications

Notifications are autonomous events triggered by the internals of the implementation and broadcasted via JSON-RPC to all registered observers. Refer to [Thunder] for information on how to register for a notification.

The following events are provided by the ContentProtection interface:

ContentProtection interface events:

Notification Description
watermarkStatusChanged / onWatermarkStatusChanged

watermarkStatusChanged notification

onWatermarkStatusChanged is an alternative name for this notification.

Notification Parameters

Name Type M/O Description
params object mandatory ...
params.sessionId integer mandatory Session id for the content protection session
params.appId string mandatory Application that should receive the notification
params.status object mandatory ...
params.status.state string mandatory ... (must be one of the following: DENIED, FAILED, GRANTED, NOT_REQUIRED)
params.status.failureReason integer mandatory Same as that returned by the SecManager. For other cases greater than 20000

Example

Registration

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "<callsign>.1.register",
  "params": {
    "event": "watermarkStatusChanged",
    "id": "myid"
  }
}

Notification

{
  "jsonrpc": "2.0",
  "method": "myid.watermarkStatusChanged",
  "params": {
    "sessionId": 930762523,
    "appId": "...",
    "status": {
      "state": "NOT_REQUIRED",
      "failureReason": 2
    }
  }
}

The client ID parameter is passed within the notification designator, i.e. <client-id>.watermarkStatusChanged.