> 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.

# Play live and on-demand streams

> Learn how to configure the FastPix Flutter Player for live and on-demand playback.

Learn how to configure the FastPix Flutter Player for live and on-demand playback.

The FastPix Flutter Player supports four playback modes, combining stream type (live or on-demand) with access level (public or private).

> **Note:** Set `streamType` explicitly to `StreamType.live` or `StreamType.onDemand`. Leaving it blank can lead to unpredictable behavior.

## Public on-demand

Anyone with the link can watch at any time. No token required.

```dart
final dataSource = FastPixPlayerDataSource.hls(
  playbackId: 'your-playback-id-here',
  streamType: StreamType.onDemand,
);

final configuration = FastPixPlayerConfiguration();
controller = FastPixPlayerController();
controller.initialize(dataSource: dataSource, configuration: configuration);
```

## Public live stream

Video streams in real time and is accessible to anyone with the link:

```dart
final dataSource = FastPixPlayerDataSource.hls(
  playbackId: 'your-playback-id-here',
  streamType: StreamType.live,
);
```

## Private on-demand

The video is available anytime but only to authorized users. Access is secured using a valid JWT token:

```dart
final dataSource = FastPixPlayerDataSource.hls(
  playbackId: 'your-playback-id-here',
  streamType: StreamType.onDemand,
  token: "jwt-token",
);
```

## Private live stream

Real-time stream with token-based access control:

```dart
final dataSource = FastPixPlayerDataSource.hls(
  playbackId: 'your-playback-id-here',
  streamType: StreamType.live,
  token: "jwt-token",
);
```

For more on token-based security, see [Secure video playback](/docs/flutter-player/secure-video-playback).