Enable leases
How it works
- When
player.load()is called, the player requests a lease from the lease endpoint - The server returns a lease ID and a TTL (which may be shorter than requested)
- The player sends the lease ID as an
X-Lease-Idheader on every key request - At 75% of the TTL, the player proactively renews the lease
- If the server revokes the lease, the next key request or renewal fails with 403
- The player emits
KEY_LEASE_EXPIREDand stops playback
Handle revocation
Lease options
| Option | Type | Default | Description |
|---|---|---|---|
leaseEndpoint | string | (required) | Base URL of the lease endpoint |
requestedTtlMs | number | 300_000 (5 min) | TTL to request. Server may return a shorter TTL. |
renewalFraction | number | 0.75 | Fraction of TTL at which to trigger renewal (0–1) |
minRenewalBufferMs | number | 30_000 | Minimum renewal buffer in ms, regardless of fraction |
When to use leases
- Subscription content: Revoke access when a user cancels their subscription
- Time-limited previews: Allow 5 minutes of free playback, then revoke
- Concurrent stream limits: Revoke the oldest session when the limit is exceeded
- Content takedowns: Immediately stop all active playback of removed content