Programmable Media

Android video player

Last updated: Jan-29-2024

The Android SDK includes a Cloudinary native video player based on ExoPlayer. This makes it easy to use the various Cloudinary video capabilities and deliver your videos, as well as capturing video analytics by default.

On this page:

To create a player, use the CldVideoPlayer class to initialize it, providing either the public ID for the video or the full Cloudinary URL:

Once you have the player instance, you can add that into a view.

Here's an example:

Note
As the CldVideoPlayer is a container for the actual ExoPlayer instance, you need to call the getPlayer() method (as shown in the example) to include it in the view.

Transformations

You can include video transformations as part of your CLDVideoPlayer instance in the same way as when using the url method. 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:

Analytics

By default, Cloudinary video analytics are enabled when using the Cloudinary native video player. This automatically sends a variety of metrics to Cloudinary to allow you to assess the performance of your video assets. Use the setAnalytics function of your player instance to switch to manual collection or disable the analytics entirely. Manual collection allows you to specify a cloud name or public ID instead of the player automatically detecting this.

For example:

or to disable:

✔️ Feedback sent!

Rate this page: