playback descriptor to load protected video in your existing player flow. This guide uses Shaka Player. See DRM support for supported media and environments.
1. Obtain the media through Access
From your backend, call the existing Access operation with the viewer’s authorized linked account. For a post, useposts:read:
playback descriptor to your frontend through your application’s authenticated response. Keep your OAuth refresh token and OnlyFans session out of the player.
If the item has no playback, use your existing ordinary-media path only when the response contains a viewable, unprotected media URL. Do not synthesize a descriptor from a raw manifest.
2. Attach the player
Install Shaka in your frontend project:video is that element and playback is the descriptor from step 1.
video.play(). The basic browser support check does not guarantee Widevine or codec support; handle errors from player.load() too.
Shaka sends the binary license challenge to the configured server. Do not add a JSON wrapper or parse the license as JSON. The Shaka DRM configuration guide describes the player setting.
Use the returned URLs unchanged. No player request filter, cross-site cookie configuration, or browser origin override is required.
3. Renew without losing the playback position
Keep the current descriptor in a mutableplayback variable. Add a renewal function next to the player initialization:
- Schedule renewal before
Date.parse(playback.expiresAt), for example 60 seconds early. - After each renewal, schedule from the replacement descriptor’s expiry.
- Before resuming a long-paused video, renew if the descriptor has expired or is near expiry. Background timers can be delayed.
- If renewal returns an access denial, stop retries and refresh access through your backend. After the renewal URL expires, fetch a new media response.
- When the video component unmounts, clear its renewal timer, wait for an in-flight renewal to settle, and call
await player.destroy().