# Google Widevine
Note
This feature is available only to ByteArk Video Cloud for Business customers. Please contact sales@byteark.com if you would like to use it.
ByteArk Player SDK for Android supports playback of content protected with Google Widevine (opens new window), in Online mode (license fetched on-demand from a license server).
# Usage
Configure the license URL on ByteArkPlayerItem via withDrmLicenseUrl(...):
val playerItem = ByteArkPlayerItemBuilder.Builder()
.withMediaId("VIDEO_ID")
.withTitle("Protected Video")
.withUrl("https://example.com/playlist.m3u8")
.withDrmLicenseUrl("https://license.example.com/widevine")
.build()
mPlayerFragment.openMedia(playerItem)
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
# Send custom headers to the license server
If the license server requires an Authorization header (or other custom headers), pass them via withDrmLicenseRequestHeaders(...):
val headers = mapOf(
"Authorization" to "Bearer YOUR_TOKEN",
"X-Custom-Header" to "value"
)
val playerItem = ByteArkPlayerItemBuilder.Builder()
.withMediaId("VIDEO_ID")
.withTitle("Protected Video")
.withUrl("https://example.com/playlist.m3u8")
.withDrmLicenseUrl("https://license.example.com/widevine")
.withDrmLicenseRequestHeaders(headers)
.build()
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
# Enable Secure Surface
To prevent screen capture while playing DRM-protected content, enable Secure Surface via ByteArkPlayerBuilder:
val playerBuilder = ByteArkPlayerBuilder.Builder()
.withContext(this)
.withControl()
.withSecureSurface()
.build()
1
2
3
4
5
2
3
4
5
| Builder method | Description |
|---|---|
withSecureSurface() | Enable Android's secure surface to prevent screen capture and recording |
Note
- DRM must use HTTPS.
- Some Android devices that lack hardware-backed Widevine may be unable to play content with high robustness settings.
- For more information or to enable DRM, contact us at support@byteark.com.