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 Server Playback Context (SPC) message. This must be encoded in base64 to be sent within the JSON body. | Yes |
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:
|
license_duration | The total duration (in seconds) that the DRM license is valid. Once this time expires, the player must request a new license to continue playback. Set to 0 for unlimited duration (not recommended for rental content). |
Sample Payloads
Widevine Sample
{
"player_payload": "<base64_encoded_key_message>",
"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" }
}
],
"license_duration": 3600
}
}
FairPlay Sample
{
"player_payload": "<base64_encoded_spc_data>"
}
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.