Skip to main content

DRM Playback

Quickplay Player is pre-integrated with common multi-DRM solutions.

Player Creation

For Playing a protected content, valid DRMScheme and license url has to be configured during player creation.

// Sample Player Creation for Platform DRM Protected Content
val url = "https://storage.googleapis.com/shaka-demo-assets/" +
"angel-one-widevine/dash.mpd"

val player = PlayerBuilder()
.mediaURL(url)
.mediaType(MediaType.DASH)
.drmScheme(DRMScheme.WIDEVINE))
.drmLicenseURL("https://cwip-shaka-proxy.appspot.com/no_auth")
.build(applicationContext)

Custom License Request Handling

There mighe be some special scenarios where in the license request needs custom handling.

Examples
  • License Request might need custom headers to be configured in some cases.
  • Application developer might want to take control of fetching the license from the resource servers with which they interface.

For such scenarios, application developers can register a DRMDelegate with the Player object before performing a load() operation and take control of License Fetching themselves.

player.drmDelegate = object : com.quickplay.vstb7.drm.DRMDelegate {
override fun onKeyResponseRequired(
assetURL: String,
request: DRMKeyRequest,
callback: Callback<ByteArray, Error>
) {
logger.trace { "key_request_enter" }
playerViewModel.coroutineScope.launch(Dispatchers.IO) {
val result = httpClient.callWith<ByteArray, ByteArray> {
url(request.defaultLicenseURL)
post(request.data)
}.awaitResult()
when (result) {
is Result.Success -> {
callback.complete(result.value, null)
logger.trace { "key_request_exit_success" }
}
is Result.Failure -> {
callback.complete(
null, Error(
PlayerErrorCodes.DRM_LICENSE_FAILURE or
ErrorCodes.ERROR_CATEGORY_MASK_NETWORK,
"Drm Fetch Failed",
result.value
)
)
logger.trace { "key_request_exit_failure" }
}
}
}
}
}

DRMKeyRequest object will contain

  1. The necessary post payload (data),
  2. The default headers (requestProperties) and
  3. The defaultLicenseURL any (if passed during Player creation (or) fetched from DRM init Date of the Media Source).
danger

callback.complete() must be invoked irrespective of whether the license request is success (or) failure. Failing to do so might stall the player and the behaviour might be undefined.