For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
StatusSupportDiscussionsLog inSign Up
Docs HomeAPI ReferenceVideo on DemandAI FeaturesLive StreamingVideo PlayerVideo DataCloud PlayoutRecipes
Docs HomeAPI ReferenceVideo on DemandAI FeaturesLive StreamingVideo PlayerVideo DataCloud PlayoutRecipes
  • Player SDKs
    • Introduction
  • Web player
    • Install the FastPix web player
    • Play uploaded videos
    • Handle playback errors
  • Android player
    • Install FastPix Android player
    • Set up the player
    • Play uploaded videos
    • Handle playback errors
  • iOS player
    • Install FastPix iOS player
    • Play uploaded videos
    • Handle playback errors
  • Flutter player
    • Install FastPix Flutter player
    • Play uploaded videos
    • Handle playback errors
      • Complete integration example
LogoLogo
StatusSupportDiscussionsLog inSign Up
On this page
  • Full app example
  • Key points
Flutter playerExamples

Complete integration example

Was this page helpful?
Previous
Built with

A full example showing how to set up the FastPix Flutter Player with video playback, configuration, and resource cleanup.

Full app example

This example demonstrates a complete Flutter app with player initialization, playback, and cleanup:

1import 'package:fastpix_player/fastpix_video_player.dart';
2import 'package:flutter/material.dart';
3
4void main() {
5 runApp(const MyApp());
6}
7
8class MyApp extends StatelessWidget {
9 const MyApp({super.key});
10
11 @override
12 Widget build(BuildContext context) {
13 return MaterialApp(
14 title: 'Fastpix Player Demo',
15 theme: ThemeData(
16 colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
17 ),
18 home: const FastPixPlayerDemo(),
19 );
20 }
21}
22
23class FastPixPlayerDemo extends StatefulWidget {
24 const FastPixPlayerDemo({super.key});
25
26 @override
27 State<FastPixPlayerDemo> createState() => _FastPixPlayerDemoState();
28}
29
30class _FastPixPlayerDemoState extends State<FastPixPlayerDemo> {
31 late FastPixPlayerController controller;
32
33 @override
34 void initState() {
35 super.initState();
36
37 // Create HLS data source
38 final dataSource = FastPixPlayerDataSource.hls(
39 playbackId: 'your-playback-id-here',
40 title: 'Sample HLS Stream',
41 description: 'A sample HLS stream from FastPix',
42 thumbnailUrl: 'https://www.example.com/thumbnail.jpg',
43 );
44
45 final configuration = FastPixPlayerConfiguration();
46 controller = FastPixPlayerController();
47 controller.initialize(dataSource: dataSource, configuration: configuration);
48 }
49
50 @override
51 Widget build(BuildContext context) {
52 return FastPixPlayer(
53 controller: controller,
54 width: 350,
55 height: 200,
56 aspectRatio: FastPixAspectRatio.ratio16x9,
57 );
58 }
59
60 @override
61 void dispose() {
62 controller.dispose();
63 super.dispose();
64 }
65}

Key points

  • The FastPixPlayerController is created in initState and disposed in dispose to prevent memory leaks.
  • FastPixPlayerDataSource.hls() constructs the data source using a playback ID. Optional fields include title, description, thumbnailUrl, token, customDomain, and qualityControl.
  • FastPixPlayerConfiguration() uses default settings. Customize it with controlsConfiguration, autoPlayConfiguration, and qualityConfiguration.
  • The FastPixPlayer widget renders the video. Set width, height, and aspectRatio to control the layout.

Replace 'your-playback-id-here' with your actual FastPix playback ID.