Skip to navigation

Control video playback

Learn how to use play, pause, seek, volume, and state controls in the FastPix Flutter Player.

The FastPixPlayerController provides methods for managing playback. All methods are available after calling initialize().

Play, pause, and seek

controller.play(); // Start or resume playback
controller.pause(); // Pause playback
controller.seekTo(Duration(seconds: 30)); // Seek to a specific position

Set volume

Set the player volume on a scale from 0.0 (silent) to 1.0 (maximum):

controller.setVolume(0.75); // Set volume to 75%

Query playback state

Check the current state and position:

final position = controller.getCurrentPosition(); // Current playback position
final duration = controller.getTotalDuration(); // Total video duration
// State checks
final isPlaying = controller.isPlaying; // Returns true if playing
final isPaused = controller.isPaused; // Returns true if paused
final isFinished = controller.isFinished; // Returns true if playback completed
final state = controller.currentState; // Current player state enum

Player states

The player can be in any of these states:

StateDescription
initializedPlayer created but not ready
readyReady to play
playingActively playing
pausedPaused
bufferingWaiting for data
finishedPlayback completed
errorError encountered

Clean up resources

Always dispose the controller when the widget is removed:

@override
void dispose() {
controller.dispose();
super.dispose();
}