DRM License
To play DRM protected videos, your player should request DRM licence from our URL.
This API requires access_token in query param for authentication.
POST: https://app.tpstreams.com/api/v1/<organization_id>/assets/<asset_id>/drm_license/?access_token={{access_token}}&drm_type={{drm_type}}
Query Parameters
| Name | Type | Description | Default |
|---|---|---|---|
drm_type | string | The type of DRM. Options: widevine, fairplay. | widevine |
Request Body
| Name | Type | Description | Required |
|---|---|---|---|
player_payload | string | For Widevine, this is the key message. For FairPlay, this is the SPC message. This must be encoded in base64. | Yes |
rental_duration_seconds | integer | Total validity period (in seconds) of a stored license on the device. Used only for persistent (offline) licenses. Defines how long the license remains usable before it expires. | No |
license_duration_seconds | integer | (Widevine only) Duration (in seconds) for which playback is allowed. This defines the active viewing window once playback begins. | No |
lease_duration_seconds | integer | (FairPlay only) Duration (in seconds) for which playback is allowed. This defines the active viewing window once playback begins. | No |
is_persistent | boolean | Set to true to allow the license to be stored on the device for offline playback. | No |
widevine | object | Additional configurations for Widevine. See the Widevine table below. | No |
Widevine Configuration Fields
Name | Description |
content_key_specs.track_type | A track type definition, Options are
|
content_key_specs.security_level | Security level for content key specs, Default = 1.
|
content_key_specs.required_output_protection.hdcp | Output protection options for HDCP Options:
|
Sample Payloads
Widevine Sample
{
"player_payload": "<base64_encoded_key_message>",
"license_duration_seconds": 3600,
"rental_duration_seconds": 7200,
"is_persistent": false,
"widevine": {
"content_key_specs": [
{
"track_type": "SD",
"security_level": 1,
"required_output_protection": { "hdcp": "HDCP_V1" }
},
{
"track_type": "HD",
"security_level": 1,
"required_output_protection": { "hdcp": "HDCP_V1" }
},
{
"track_type": "UHD1",
"security_level": 1,
"required_output_protection": { "hdcp": "HDCP_V1" }
},
{
"track_type": "UHD2",
"security_level": 1,
"required_output_protection": { "hdcp": "HDCP_V1" }
},
{
"track_type": "AUDIO",
"security_level": 1,
"required_output_protection": { "hdcp": "HDCP_V1" }
}
]
}
}
FairPlay Sample
{
"player_payload": "<base64_encoded_spc_data>",
"lease_duration_seconds": 3600,
"rental_duration_seconds": 7200,
"is_persistent": true
}
Response
The API returns the raw binary license which should be passed directly to the browser's CDM or the player SDK.
- Status Code:
200 OK - Content-Type:
application/octet-stream - Body: Raw binary data (Widevine License or FairPlay Content Key Context).
Security Considerations:
The recommendation is to invoke the DRM license endpoint on the server, rather than on the client. This precaution is taken because passing the License configuration and calling it from the client could expose configurations to users.