Skip to navigation

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.

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:

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:

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:

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.