Skip to navigation

Play DRM-protected content

Play Widevine DRM-protected FastPix streams in the FastPix Android Player.

The FastPix Android Player SDK plays Widevine-protected HLS streams. To play a protected stream, provide both a playbackToken, which authorizes secure playback, and a drmConfig, which enables DRM on the media item. If you set a playbackToken without a drmConfig, playback fails with a DRM configuration error, reported through PlaybackListener.onError.


Before you begin

Make sure you have the following:


Set up basic DRM playback

Provide the playbackToken and a default drmConfig in your setFastPixMediaItem configuration. The default DrmConfig() targets the Widevine UUID with multiSession enabled. Use streamType so the SDK resolves the correct FastPix DRM license endpoint for on-demand or live content.

import io.fastpix.media3.core.DrmConfig
import io.fastpix.media3.core.FastPixPlayer
import io.fastpix.media3.core.StreamType
val player = FastPixPlayer.Builder(this)
.setAutoplay(true)
.build()
binding.playerView.player = player
player.setFastPixMediaItem {
playbackId = "your-playback-id"
streamType = StreamType.onDemand // Use StreamType.live for live streams
playbackToken = "your-secure-playback-token"
drmConfig = DrmConfig() // Defaults to Widevine UUID, multiSession=true
}

Customize DRM options

Pass a configured DrmConfig to set the DRM UUID and session behavior explicitly.

import androidx.media3.common.C
import io.fastpix.media3.core.DrmConfig
player.setFastPixMediaItem {
playbackId = "your-playback-id"
playbackToken = "your-secure-playback-token"
drmConfig = DrmConfig(
uuid = C.WIDEVINE_UUID,
multiSession = true
)
}

Things to know

  • The current SDK DRM flow targets Widevine-protected FastPix HLS playback.
  • The DRM token’s audience is "aud": "drm:<playbackId>". The same token authorizes both the stream and the licence request.
  • streamType helps resolve the correct FastPix DRM license endpoint (on-demand or live).
  • Always test DRM streams on real devices, and target the Android API levels you support.
  • A playbackToken without a drmConfig produces a DRM configuration error (code 9010) through PlaybackListener.onError.
  • Pre-caching warms a DRM video’s playlists and segments, but the Widevine licence is still requested on every play, so a warmed DRM video starts a few hundred milliseconds later than a clear one. See Pre-cache videos before a player exists.

Frequently asked questions

Which DRM systems does the Android player support?

The FastPix Android Player SDK supports Widevine for protected FastPix HLS streams. The default DrmConfig() uses the Widevine UUID.

Do I need both a playback token and a DrmConfig?

Yes. A protected stream needs the playbackToken to authorize playback and a drmConfig to enable DRM on the media item. Setting a playbackToken without a drmConfig results in a DRM configuration error through PlaybackListener.onError.

How do I play a live DRM stream?

Set streamType = StreamType.live in setFastPixMediaItem. The streamType value lets the SDK resolve the correct FastPix DRM license endpoint for live or on-demand content.

Why does DRM playback work in the emulator but fail on some devices?

DRM behavior depends on the device’s Widevine security level and Android version. Always test DRM streams on real devices across the API levels you support.


What’s next