API Reference
After creating ByteArkPlayerController, you can call the player API directly through the controller instance.
Lifecycle methods
| Method | Description |
setListener(ByteArkPlayerListener? newListener) | Set or change the event listener |
attach() | Attach the controller to the ByteArkPlayer widget (called automatically when the widget mounts) |
detach() | Detach the controller (called automatically when the widget unmounts) |
dispose() | Release the listener and controller resources — call in State.dispose() |
Playback controller
| Method | Description |
play() | Start playback |
pause() | Pause playback |
togglePlayback() | Toggle play/pause |
seekTo(int position) | Seek to a position (milliseconds) |
seekForward() | Seek forward by the config's seekTime |
seekBackward() | Seek backward by the config's seekTime |
| Method | Description |
switchMediaSource(ByteArkPlayerConfig config) | Switch to a new video by passing a new config |
Tracks & quality
| Method | Description |
setAudio(ByteArkPlayerMediaTrack track) | Select an audio track |
setSubtitle(ByteArkPlayerMediaTrack? track) | Select a subtitle (pass null to disable) |
setResolution(ByteArkPlayerMediaTrack track) | Select a video resolution |
Playback speed
| Method | Description |
setPlaybackSpeed(double speed) | Set playback speed (e.g., 0.5, 1.0, 1.5, 2.0) |
UI controller
| Method | Description |
toggleFullScreen() | Toggle full-screen mode |