DRM playback
Quickplay Player is pre-integrated with common multi-DRM solutions.
Player creation
To play protected content, you must configure a valid DRMScheme and license url 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 might be some special scenarios where the license request needs custom handling.
Examples
- License requests might need custom headers to be configured in some cases.
- You might want to take control of fetching the license from the resource servers with which you interface.
For such scenarios, you can register a DRMDelegate with the Player object before performing a load() operation and take control of license fetching yourself.
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 contains:
- The necessary post payload (data).
- The default headers (requestProperties).
- The defaultLicenseURL (if passed during Player creation or fetched from DRM init Data of the media source).
warning
You must invoke callback.complete() regardless of whether the license request
succeeds or fails. Failing to do so might stall the player and the behavior
might be undefined.