Play live and on-demand streams

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.

1final dataSource = FastPixPlayerDataSource.hls(
2 playbackId: 'your-playback-id-here',
3 streamType: StreamType.onDemand,
4);
5
6final configuration = FastPixPlayerConfiguration();
7controller = FastPixPlayerController();
8controller.initialize(dataSource: dataSource, configuration: configuration);

Public live stream

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

1final dataSource = FastPixPlayerDataSource.hls(
2 playbackId: 'your-playback-id-here',
3 streamType: StreamType.live,
4);

Private on-demand

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

1final dataSource = FastPixPlayerDataSource.hls(
2 playbackId: 'your-playback-id-here',
3 streamType: StreamType.onDemand,
4 token: "jwt-token",
5);

Private live stream

Real-time stream with token-based access control:

1final dataSource = FastPixPlayerDataSource.hls(
2 playbackId: 'your-playback-id-here',
3 streamType: StreamType.live,
4 token: "jwt-token",
5);

For more on token-based security, see Secure video playback.