# ความละเอียดวิดีโอ (Resolution)

ByteArk Player SDK for Android รองรับการเลือกความละเอียดของวิดีโอ ทั้งแบบอัตโนมัติ (Adaptive Bitrate Streaming) และให้ผู้ชมเลือกเองได้

# Adaptive Bitrate Streaming (ABR)

โดยค่าเริ่มต้น Player จะปรับความละเอียดอัตโนมัติตามความเร็วของอินเทอร์เน็ต ผ่านกลไก ABR ของ ExoPlayer

# ให้ผู้ชมเลือกความละเอียดผ่าน Setting button

เปิด withSettingButton() จะแสดงปุ่มตั้งค่าที่ผู้ชมสามารถเลือกความละเอียดได้

val playerBuilder = ByteArkPlayerBuilder.Builder()
  .withContext(this)
  .withControl()
  .withSettingButton()
  .build()
1
2
3
4
5

# เลือกความละเอียดผ่าน API

// ดูรายการความละเอียดทั้งหมด
val resolutions: List<ByteArkResolution> = mPlayerFragment.getResolutions()
// ความละเอียดปัจจุบัน
val current: ByteArkResolution? = mPlayerFragment.getCurrentResolution()
// เลือกความละเอียด
mPlayerFragment.setResolution(resolutions[0])
1
2
3
4
5
6
7
8

Note

หากกำหนดความละเอียดเอง Player จะเล่นที่ความละเอียดนั้นโดยไม่ปรับอัตโนมัติ หากต้องการกลับไปใช้ ABR ผู้ชมสามารถเลือกตัวเลือก "Auto" จาก Setting button ได้