# การปรับตั้งค่า Options
การปรับแต่ง ByteArk Player ทำได้ผ่าน Class 2 ตัว: ByteArkPlayerConfig สำหรับตั้งค่าการทำงานของ Player และ ByteArkPlayerItem สำหรับกำหนดข้อมูลของวิดีโอที่จะเล่น
# ByteArkPlayerConfig
final config = ByteArkPlayerConfig(
licenseKey: ByteArkPlayerLicenseKey(
android: "<ANDROID_LICENSE_KEY>",
iOS: "<IOS_LICENSE_KEY>",
),
playerItem: playerItem,
autoPlay: true,
control: true,
);
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
| Property | Type | Default | Description |
|---|---|---|---|
licenseKey | ByteArkPlayerLicenseKey | required | License key สำหรับ Android และ iOS |
playerItem | ByteArkPlayerItem | required | วิดีโอที่จะเล่น |
autoPlay | bool? | true | เริ่มเล่นวิดีโออัตโนมัติ |
control | bool? | true | แสดงแถบควบคุม |
seekButtons | bool? | true | แสดงปุ่ม Seek เดินหน้า/ถอยหลัง |
seekTime | int? | 30 | ระยะเวลา Seek (วินาที) |
fullScreenButton | bool? | true | แสดงปุ่ม Full Screen |
settingButton | bool? | true | แสดงปุ่มตั้งค่า |
secureSurface | bool? | false | เปิด Secure Surface สำหรับเนื้อหา DRM |
subtitleSize | ByteArkPlayerSubtitleSize? | medium | ขนาดตัวอักษรซับไตเติ้ล (small/medium/large) |
subtitleBackgroundEnabled | bool? | true | แสดงพื้นหลังตัวอักษรซับไตเติ้ล |
subtitlePaddingBottomPercentage | int? | 10 | ระยะห่างของซับไตเติ้ลจากขอบล่าง (%) |
adsSettings | ByteArkAdsSettings? | - | ตั้งค่าโฆษณา (ดู การเล่นโฆษณา) |
lighthouseSetting | ByteArkLighthouseSetting? | - | ตั้งค่า Lighthouse (ดู ByteArk Lighthouse) |
# ByteArkPlayerLicenseKey
final licenseKey = ByteArkPlayerLicenseKey(
android: "<ANDROID_LICENSE_KEY>",
iOS: "<IOS_LICENSE_KEY>",
);
1
2
3
4
2
3
4
| Property | Type | Description |
|---|---|---|
android | String | License key สำหรับ Android |
iOS | String | License key สำหรับ iOS |
# ByteArkPlayerItem
final playerItem = ByteArkPlayerItem(
url: "<MEDIA_URL>",
title: "Big Buck Bunny",
);
1
2
3
4
2
3
4
| Property | Type | Required | Description |
|---|---|---|---|
url | String? | Yes | URL ของวิดีโอ (HLS .m3u8) |
mediaId | String? | No | ID ของวิดีโอ (จำเป็นเมื่อเปิดใช้ Lighthouse) |
title | String? | No | ชื่อวิดีโอ |
subtitle | String? | No | คำอธิบาย/ตอน |
posterImage | String? | No | URL ของภาพปก |
shareUrl | String? | No | URL ที่จะใช้แชร์ |
drm | ByteArkDrm? | No | DRM configuration (Widevine/FairPlay) |
lighthouseMetaData | ByteArkPlayerLighthouseMetaData? | No | Metadata สำหรับ Lighthouse |
# ByteArkAdsSettings
final adsSettings = ByteArkAdsSettings(
adTagUrl: "<VAST_TAG_URL>",
);
1
2
3
2
3
| Property | Type | Description |
|---|---|---|
adTagUrl | String? | URL ของ VAST/VMAP ad tag |
enableDefaultCompanionSlot | bool? | เปิดใช้ Companion Ad slot เริ่มต้น |
defaultCompanionSize | Pair<int, int>? | ขนาดของ Companion Ad (width, height) |
# ByteArkLighthouseSetting
final lighthouseSetting = ByteArkLighthouseSetting(
projectId: "<PROJECT_ID>",
debug: false,
);
1
2
3
4
2
3
4
| Property | Type | Description |
|---|---|---|
projectId | String? | Lighthouse Project ID |
debug | bool? | เปิดใช้ Debug mode |
# ByteArkDrm
final drm = ByteArkDrm(
widevineDrm: WidevineDrm(
licenseUrl: "<WIDEVINE_LICENSE_URL>",
),
fairPlayDrm: FairPlayDrm(
licenseUrl: "<FAIRPLAY_LICENSE_URL>",
certificateUrl: "<FAIRPLAY_CERTIFICATE_URL>",
),
);
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
| Property | Type | Description |
|---|---|---|
widevineDrm | WidevineDrm? | การตั้งค่า Widevine สำหรับ Android (ดู Google Widevine) |
fairPlayDrm | FairPlayDrm? | การตั้งค่า FairPlay สำหรับ iOS (ดู Apple FairPlay) |