# Google Widevine
Note
ฟีเจอร์นี้ของ ByteArk Player รองรับเฉพาะผู้ใช้ ByteArk Video Cloud for Business หากคุณต้องการใช้งานกรุณาติดต่อ sales@byteark.com
ByteArk Player SDK for Flutter รองรับการเล่นวิดีโอที่ป้องกันด้วย Google Widevine (opens new window) บน Android โดย Flutter SDK จะส่ง DRM configuration ผ่านไปยัง ExoPlayer ของ Android SDK เพื่อจัดการ License และ Decryption
# การใช้งาน
กำหนด WidevineDrm ผ่าน ByteArkDrm ของ ByteArkPlayerItem
final playerItem = ByteArkPlayerItem(
url: "<MEDIA_URL>",
drm: ByteArkDrm(
widevineDrm: WidevineDrm(
licenseUrl: "<WIDEVINE_LICENSE_URL>",
),
),
);
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
| Property | Type | Required | Description |
|---|---|---|---|
licenseUrl | String? | Yes | URL ของ Widevine License server |
licenseRequestHeaders | Map<String, String>? | No | Custom header ที่ส่งไปยัง License server |
# ส่ง Custom Header ไปยัง License Server
หาก License server ต้องการ Authorization header หรือ header อื่นๆ สามารถส่งผ่าน licenseRequestHeaders
final playerItem = ByteArkPlayerItem(
url: "<MEDIA_URL>",
drm: ByteArkDrm(
widevineDrm: WidevineDrm(
licenseUrl: "<WIDEVINE_LICENSE_URL>",
licenseRequestHeaders: {
"Authorization": "Bearer <YOUR_TOKEN>",
},
),
),
);
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
# เปิด Secure Surface
เพื่อป้องกันการ Capture หน้าจอ ขณะเล่นเนื้อหาที่ป้องกันด้วย DRM แนะนำให้เปิด Secure Surface ผ่าน ByteArkPlayerConfig
final config = ByteArkPlayerConfig(
licenseKey: licenseKey,
playerItem: playerItem,
secureSurface: true,
);
1
2
3
4
5
2
3
4
5
ข้อควรระวัง
- การใช้งาน DRM ต้องใช้งานผ่าน HTTPS เท่านั้น
- บางอุปกรณ์ Android ที่ไม่รองรับ Hardware-backed Widevine จะไม่สามารถเล่นวิดีโอที่ Robustness สูงได้