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
      • Play live and on-demand streams
      • Control video playback
      • Control playback resolution
      • Switch videos dynamically
LogoLogo
StatusSupportDiscussionsLog inSign Up
On this page
  • Update the data source
  • When to use this
Flutter playerPlayback

Switch videos dynamically

Was this page helpful?
Previous

Secure video playback

Next
Built with

Learn how to change the video source at runtime without reinitializing the FastPix Flutter Player.

You can switch to a different video, refresh a JWT token, or change the custom domain without rebuilding the player. Use the updateDataSource() method on the controller.

Update the data source

Create a new data source and pass it to the controller:

1final newDataSource = FastPixPlayerDataSource.hls(
2 playbackId: 'new-playback-id',
3 customDomain: 'new-domain.com',
4 token: 'new-token',
5);
6await controller.updateDataSource(newDataSource);

When to use this

  • Play a different video after the current one finishes.
  • Refresh an expired JWT token without interrupting the player lifecycle.
  • Switch between on-demand and live content within the same player instance.
  • Change the custom domain for playback delivery.