ThaNativePlayerController class

Bridge between Flutter and the native player implementation.

The controller manages the playlist, lifecycle, and exposes convenience methods like play, pause, seekTo, and track selection.

Constructors

ThaNativePlayerController.playlist(List<ThaMediaSource> playlist, {bool autoPlay = true, bool loop = false, ThaPlaybackOptions playbackOptions = const ThaPlaybackOptions()})
Create a controller for a custom playlist.
ThaNativePlayerController.single(ThaMediaSource source, {bool autoPlay = true, bool loop = false, ThaPlaybackOptions playbackOptions = const ThaPlaybackOptions()})
Create a controller with a single media item.

Properties

autoPlay bool
final
creationParams Map<String, dynamic>
Serialized arguments that are passed to the platform view.
no setter
events → ThaNativeEvents?
Playback events emitted by the native layer.
no setter
hashCode int
The hash code for this object.
no setterinherited
loop bool
final
playbackOptions ThaPlaybackOptions
final
playlist List<ThaMediaSource>
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

attachViewId(int id) → void
Bind the controller to a platform view id.
clearVideoTrackSelection() Future<void>
Clears manual track overrides and returns to automatic selection.
dispose() Future<void>
Release native resources.
enterPictureInPicture() Future<bool>
Requests picture-in-picture mode where supported.
getAudioTracks() Future<List<ThaAudioTrack>>
Retrieves the available audio tracks.
getSubtitleTracks() Future<List<ThaSubtitleTrack>>
Retrieves legible subtitle / caption tracks.
getVideoTracks() Future<List<ThaVideoTrack>>
Retrieves the available video tracks from the native player.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pause() Future<void>
Pause playback while retaining the buffer.
play() Future<void>
Begin playback if ready.
retry() Future<void>
Re-prepares the media source and attempts to resume playback.
seekTo(Duration position) Future<void>
Seek to a new position.
selectAudioTrack(String? trackId) Future<void>
Selects an audio track. Passing null restores the default selection.
selectSubtitleTrack(String? trackId) Future<void>
Selects a subtitle track. Passing null disables text rendering.
selectVideoTrack(String trackId) Future<void>
Select a specific video track by trackId.
setBoxFit(BoxFit fit) Future<void>
Update the content scaling of the platform view.
setDataSaver(bool enable) Future<void>
Caps the bitrate when enable is true in order to save data.
setLooping(bool looping) Future<void>
Toggle looping for the current item or playlist.
setSpeed(double speed) Future<void>
Adjust the playback speed.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited