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

1controller.play(); // Start or resume playback
2controller.pause(); // Pause playback
3controller.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):

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

Query playback state

Check the current state and position:

1final position = controller.getCurrentPosition(); // Current playback position
2final duration = controller.getTotalDuration(); // Total video duration
3
4// State checks
5final isPlaying = controller.isPlaying; // Returns true if playing
6final isPaused = controller.isPaused; // Returns true if paused
7final isFinished = controller.isFinished; // Returns true if playback completed
8final 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:

1@override
2void dispose() {
3 controller.dispose();
4 super.dispose();
5}