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:
ContentProtection interface methods:
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 | opaque object | 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 | opaque object | mandatory | Video platform specific response data |
Example
Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.openDrmSession",
"params": {
"clientId": "...",
"appId": "...",
"keySystem": "playready",
"licenseRequest": "...",
"initData": {}
}
}
Response
{
"jsonrpc": "2.0",
"id": 42,
"result": {
"sessionId": 0,
"openSessionResponse": {}
}
}
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 |
Example
Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.setDrmSessionState",
"params": {
"sessionId": 0,
"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 | opaque object | mandatory | Video platform specific init data |
Result
Name | Type | M/O | Description |
---|---|---|---|
result | opaque object | mandatory | Video platform specific response data |
Example
Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.updateDrmSession",
"params": {
"sessionId": 0,
"licenseRequest": "...",
"initData": {}
}
}
Response
{
"jsonrpc": "2.0",
"id": 42,
"result": {}
}
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 | null | mandatory | Always null |
Example
Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.closeDrmSession",
"params": {
"sessionId": 0
}
}
Response
{
"jsonrpc": "2.0",
"id": 42,
"result": null
}
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 in range [0..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": 0,
"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": 0,
"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 |
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": 0,
"appId": "...",
"status": {
"state": "NOT_REQUIRED",
"failureReason": 0
}
}
}
The client ID parameter is passed within the notification designator, i.e.
<client-id>.watermarkStatusChanged
.