Skip to content

DRM tokens & license renewal

Most DRM deployments authorize license requests with short-lived tokens. Give OGPlayer a token provider and it fetches a fresh token on every license request — renewals included — so playback survives long pauses and license expiry without your code doing anything.

There is no standard header for DRM tokens — every vendor defines their own (Axinom: X-AxDRM-Message, castLabs DRMtoday: x-dt-auth-token, vuDRM: x-vudrm-token). Use whatever name your license server expects; the examples below use Axinom’s.

DrmConfig.Builder(licenseUrl)
.setTokenProvider("X-AxDRM-Message") { tokenService.freshToken() } // suspend fun
.build()
// URL-embedded tokens: .setUrlTokenProvider { ... } with {token} in the URL

Semantics, identical everywhere:

  • The provider’s headers are merged over any static headers.
  • A provider failure surfaces as 4002 DRM_TOKEN_FETCH_FAILED (retryable).
  • Successful renewals fire PlaybackListener.onDrmSessionRenewed(reason) — your signal that a long-running session quietly refreshed.