FlutterNativePlayerController class

A controller that provides full control over the native video player.

Use this controller to interact with the player programmatically:

  • Play, pause, seek
  • Change playback speed
  • Change video quality
  • Control subtitles
  • Monitor playback state and duration

Example:

final controller = FlutterNativePlayerController();

// Listen to playback state changes
controller.playbackStateStream.listen((state) {
  if (state == PlaybackState.play) {
    print('Video is playing');
  }
});

// Control playback
controller.play();
controller.pause();
controller.seekTo(Duration(seconds: 30));

Properties

bufferedDuration → Duration
Buffered duration
no setter
currentPosition → Duration
Current playback position
no setter
currentQualityHeight → int
Get current video quality height
no setter
currentQualityUrl → String
Get current quality URL
no setter
currentQualityWidth → int
Get current video quality width
no setter
currentSpeed → double
Get current playback speed
no setter
currentSubtitle → PlayerKidSubtitlesSource?
Get current selected subtitle
no setter
downloadProgressStream → Stream<double>
Stream of download progress (0.0 to 100.0)
no setter
downloadStateStream → Stream<DownloadState>
Stream of download state changes
no setter
durationState → DurationState?
Current duration state (position, buffered, total)
no setter
durationStateStream → Stream<DurationState>
Stream of duration state changes (current position, buffered, total duration)
no setter
fetchHlsMasterPlaylist → FetchHlsMasterPlaylist
Get the internal FetchHlsMasterPlaylist for subtitle handling
no setter
hashCode → int
The hash code for this object.
no setterinherited
isInitialized → bool
Whether the controller has been initialized
no setter
isLoading → bool
Whether the player is currently loading
no setter
loadingStream → Stream<bool>
Stream of loading state changes
no setter
playbackState → PlaybackState
Current playback state
no setter
playbackStateStream → Stream<PlaybackState>
Stream of playback state changes (play, pause, loading, finish, etc.)
no setter
playerMethodManager → PlayerMethodManager
Get the internal PlayerMethodManager for advanced usage
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
subtitleStream → Stream<PlayerKidSubtitlesSource?>
Stream of subtitle changes
no setter
totalDuration → Duration
Total duration of the video
no setter

Methods

cancelDownload() → Future<void>
Cancel current download
changeQuality(QualityModel quality) → Future<void>
Change video quality
changeSubtitle(PlayerKidSubtitlesSource subtitle) → Future<void>
Change subtitle
disableSubtitle() → Future<void>
Disable/turn off subtitle
dispose() → void
Dispose the controller and release resources
getAvailableQualities() → List<QualityModel>
Get available video qualities
getAvailableSubtitles() → List<PlayerKidSubtitlesSource>
Get available subtitles
initialize({required PlayerResource playerResource, required bool playWhenReady}) → void
Initialize the controller (called internally by FlutterNativePlayer)
isDownloadCompleted(String url, void callback(bool)) → Future<void>
Check if video is downloaded
isPlaying() → Future<bool>
Check if the video is currently playing
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pause() → Future<void>
Pause video playback
play() → Future<void>
Start or resume video playback
playOrPause() → Future<void>
Toggle between play and pause based on current state
reinitialize() → Future<void>
Reinitialize the player
release() → Future<void>
Release the player resources
restart() → Future<void>
Restart the video from the beginning
retryDownload() → Future<void>
Retry failed download
seekBackward([Duration duration = const Duration(seconds: 10)]) → Future<void>
Seek backward by the specified duration (default: 10 seconds)
seekForward([Duration duration = const Duration(seconds: 10)]) → Future<void>
Seek forward by the specified duration (default: 10 seconds)
seekTo(Duration position) → Future<void>
Seek to a specific position
setPlaybackSpeed(double speed) → Future<void>
Set playback speed (e.g., 0.5, 1.0, 1.5, 2.0)
showDevices() → Future<void>
Show available audio/video devices (platform specific)
startDownload(PlayerResource playerResource, int trackIndex) → Future<void>
Start downloading the video at specified quality
toString() → String
A string representation of this object.
inherited

Operators

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