> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://fastpix.com/docs/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://fastpix.com/docs/_mcp/server.

# Control video playback

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

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

```dart
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):

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

## Query playback state

Check the current state and position:

```dart
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:

| State         | Description                  |
| ------------- | ---------------------------- |
| `initialized` | Player created but not ready |
| `ready`       | Ready to play                |
| `playing`     | Actively playing             |
| `paused`      | Paused                       |
| `buffering`   | Waiting for data             |
| `finished`    | Playback completed           |
| `error`       | Error encountered            |

## Clean up resources

Always dispose the controller when the widget is removed:

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