# 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 Flutter supports playback of content protected with Google Widevine (opens new window) on Android. The Flutter SDK passes the DRM configuration through to Android's ExoPlayer to handle licensing and decryption.

Note

Widevine requires an MPEG-DASH (.mpd) source.

# Usage

Attach WidevineDrm to a source using the ByteArkPlayerSource.drm factory:

final playerItem = ByteArkPlayerItem(
  sources: [
    ByteArkPlayerSource.drm(
      url: "<DASH_MPD_URL>",
      drm: WidevineDrm(
        licenseUrl: "<WIDEVINE_LICENSE_URL>",
      ),
    ),
  ],
);
1
2
3
4
5
6
7
8
9
10
Property Type Required Description
licenseUrl String? Yes Widevine license server URL
licenseRequestHeaders Map<String, String>? No Custom headers for the license request

# Send custom headers

final playerItem = ByteArkPlayerItem(
  sources: [
    ByteArkPlayerSource.drm(
      url: "<DASH_MPD_URL>",
      drm: WidevineDrm(
        licenseUrl: "<WIDEVINE_LICENSE_URL>",
        licenseRequestHeaders: {
          "Authorization": "Bearer <YOUR_TOKEN>",
        },
      ),
    ),
  ],
);
1
2
3
4
5
6
7
8
9
10
11
12
13

Note

If you use ByteArk Multi-DRM, see Generating an Authorization Token for the DRM License Server (Thai) to learn how to create the JWT token for the Authorization header.

# Enable Secure Surface

To prevent screen capture while playing DRM-protected content, enable Secure Surface via ByteArkPlayerConfig:

final config = ByteArkPlayerConfig(
  licenseKey: licenseKey,
  playerItem: playerItem,
  secureSurface: true,
);
1
2
3
4
5

Caution

  • DRM must use HTTPS.
  • Some Android devices that lack hardware-backed Widevine may not be able to play content with high robustness settings.