Programmable Media

Flutter video player

Last updated: Jan-29-2024

The Flutter SDK includes a Cloudinary native video player built on top of the Video Player plugin for Flutter. This makes it easy to use the various Cloudinary video capabilities and deliver your videos using the device's native player. For Android, the player uses ExoPlayer and for iOS it uses AVPlayer.

On this page:

To create a player, use the CldVideoController to create a new controller instance and provide either the public ID for the video or the full Cloudinary URL:

Note
If you haven't set your Cloudinary credentials as an environment variable, you need to include the cloudinary object alongside the publicId parameter. For example:

Once you have the player controller instance, you can add that to the VideoPlayer imported from the Video Player plugin.

Here's a fully working example of a simple view that renders the video player and a play/pause button:

Transformations

You can include video transformations as part of your CldVideoController instance to generate a variation of the original asset. The transformations are defined when initializing the player. For example:

Note

Automatic streaming profile selection is enabled by default. This currently has a limited set of transformations that you can combine with it, therefore when using any transformations, automatic streaming profile selection will be disabled. If you want to include both, check that your transformations are supported and set the streaming profile transformation to auto when initializing your player, for example:

✔️ Feedback sent!

Rate this page: