CdmApi

interface CdmApi

The operations a CDM offers, whether it runs in this process or behind an HTTP server.

Cdm implements this locally. ktvine-remote's RemoteCdm implements it against a pywidevine-compatible server, so callers can swap one for the other.

This is deliberately the common subset. Things a remote server has no endpoint for — reading back the parsed License, entitlement key unwrapping — stay on Cdm.

Inheritors

Functions

Link copied to clipboard
abstract suspend fun close(sessionId: ByteString)

Close a session and release its slot.

Link copied to clipboard
abstract suspend fun getKeys(sessionId: ByteString, type: License.KeyContainer.KeyType? = null): List<Key>

The decrypted keys for the session, optionally filtered by type.

Link copied to clipboard
abstract suspend fun getLicenseChallenge(sessionId: ByteString, pssh: PSSH, licenseType: LicenseType = LicenseType.STREAMING, privacyMode: Boolean = true, requestType: LicenseRequest.RequestType = LicenseRequest.RequestType.NEW): ByteArray

Build a signed license request for pssh.

Link copied to clipboard
abstract suspend fun getServiceCertificateBase64(sessionId: ByteString): String?

The service certificate currently set for the session, Base64-encoded, or null.

Link copied to clipboard
abstract suspend fun open(): ByteString

Open a session.

Link copied to clipboard
abstract suspend fun parseLicense(sessionId: ByteString, licenseMessage: ByteArray)

Verify and parse a license response, loading its keys into the session.

Link copied to clipboard
abstract suspend fun setServiceCertificate(sessionId: ByteString, certificateBase64: String?): String?

Set or clear the service certificate used for privacy mode.