Video Player Integration
Native Apps Integration
Android
DRM support

Integrating in WebView Android

DRM support

DRM support using Genius Live Player requires additional steps to be made, this is because some of the content being offered is protected and the browser needs to know whether to allow the protected media to be processed or not, this usually happens in all browsers only once when a DRM media is being played and the browser prompts whether to enable DRM playback.

Since android's webview is a headless chrome browser inside an app, the prompt never triggers and the required permission is never granted. To grant this permission, the webview's chrome client has to do it silently from the android's native code side.

webview.webChromeClient = object : WebChromeClient() {
	override fun onPermissionRequest(request: PermissionRequest?) {
		val permissions = arrayOf(PermissionRequest.RESOURCE_PROTECTED_MEDIA_ID)
		request.grant(permissions)
	}
}

Depending of the context, the video player may need to activate DRM due to legal restrictions, thus preventing screen sharing.

To prevent screenshots within your app due to a limitation in the webView, you need to incorporate the following lines of code in the Activity where the webView is created. This is necessary because the webView allows for taking screenshots displaying video content even when the DRM feature is activated.

Incorporate this code line within the OnCreate() method.

ⓘ Important!
This line of code is going to block the capability for taking screenshots in this view.

override fun onCreate(savedInstanceState: Bundle?) {
  ...
  // Lock screenshot
  window.addFlags(WindowManager.LayoutParams.FLAG_SECURE)
}