Last updated: Jan-29-2024
The iOS SDK includes a Cloudinary native video player based on AVPlayer. This makes it easy to use the various Cloudinary video capabilities and deliver your videos as well as capturing video analytics by default.
To create a player, use the CLDVideoPlayer
function to initialize it, providing either the public ID for the video or the full Cloudinary URL:
Once you have the player instance, you can embed that into an AVPlayerViewController
to use in your view.
Here's an example:
Transformations
You can include video transformations as part of your CLDVideoPlayer
instance in the same way as when using the createUrl method. The transformations are defined when initializing the player. For example:
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 enable automatic streaming profile selection by setting automaticStreamingProfile: true
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:
Thanks for your time!