跳到主要内容

DRM

To play DRM-protected videos, please specify license server URLs and options with DRM.

BlendVision One drmUrl can be found on here, and playbackToken is the same token to start a playback session

val DRM_KEY = "x-custom-data"
val DRM_VALUE = "token_type=upfront&token_value=$PLAYBACK_TOKEN"

val mediaConfig = MediaConfig(
source = MediaConfig.Source(
...
drm = MeidaConfig.DrmInfo.Widevine(
licenseUrl = "$DRM_LICENSE_URL",
headers = mapOf(DRM_KEY to DRM_VALUE)
)
),
...
)

player.load(mediaConfig)

Advence setting

Some devices may not support hardware (L1) DRM decryption, resulting in content that cannot be played successfully. Therefore, we also provide software (L3) DRM decryption to playback contents. L3 can not control with hardware device, need to pair with setSurfaceSecure(Boolean) method to prevent recording and screenshot.

Example:

// when activity/fragment created
binding.uniView.setSurfaceSecure(true)

// prepare the media config
val mediaConfig = MediaConfig(
source = MediaConfig.Source(
...
drm = MeidaConfig.DrmInfo.Widevine(
...
drmSecurityLevel = DrmSecurityLevel.L3
)
),
...
)
// load the config
player.load(mediaConfig)