# Apple FairPlay
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 Apple FairPlay Streaming (FPS) (opens new window) on iOS. The Flutter SDK passes the DRM configuration through to iOS's AVPlayer to handle licensing and decryption.
Note
FairPlay requires an HLS (.m3u8) source.
# Usage
Attach FairPlayDrm to a source using the ByteArkPlayerSource.drm factory:
final playerItem = ByteArkPlayerItem(
sources: [
ByteArkPlayerSource.drm(
url: "<HLS_M3U8_URL>",
drm: FairPlayDrm(
licenseUrl: "<FAIRPLAY_LICENSE_URL>",
certificateUrl: "<FAIRPLAY_CERTIFICATE_URL>",
),
),
],
);
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
| Property | Type | Required | Description |
|---|---|---|---|
licenseUrl | String? | Yes | FairPlay license server URL (for fetching CKC) |
certificateUrl | String? | Yes | FairPlay Application Certificate URL |
licenseRequestHeaders | Map<String, String>? | No | Custom headers for the license request |
# Send custom headers
final playerItem = ByteArkPlayerItem(
sources: [
ByteArkPlayerSource.drm(
url: "<HLS_M3U8_URL>",
drm: FairPlayDrm(
licenseUrl: "<FAIRPLAY_LICENSE_URL>",
certificateUrl: "<FAIRPLAY_CERTIFICATE_URL>",
licenseRequestHeaders: {
"Authorization": "Bearer <YOUR_TOKEN>",
},
),
),
],
);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
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.
Caution
- DRM must use HTTPS.
- FairPlay decryption works only on physical devices, not the iOS Simulator.