Skip to content

Configuring CldVideoPlayer

Required Props

The basic props required to use CldVideoPlayer include:

Prop Type Required Example
height string | numberYes1080Player Height
src stringYes"videos/publicid"Cloudinary Public ID
width string | numberYes1920Player Width

Customization

The CldVideoPlayer component allows you to customize your player opting into more advanced capabilities like an AI-based highlights graph and simpler options like configuring the color scheme.

Prop Type Default Example
aiHighlightsGraph booleanfalsetrueMore Info
bigPlayButton boolean | stringtrue"init"More Info
chaptersButton booleanfalsetrueMore Info
colors objectSee Colors BelowSee Colors BelowMore Info
controlBar object- More Info
controls booleantruetrueMore Info
floatingWhenNotVisible string-"left"More Info
fluid booleantruefalseMore Info
fontFace stringFira Sans`"Source Serif Pro"`More Info
hideContextMenu booleanfalsetrueMore Info
interactionAreas any- More Info
logo boolean | object-See Logo BelowMore Info
playbackRates array- More Info
playlistWidget object- More Info
poster string/object-See Poster BelowMore Info
posterOptions object- More Info
showJumpControls boolean- More Info
showLogo booleantruefalseMore Info
seekThumbnails booleantruefalseMore Info

Colors

The colors prop takes an object that can control what colors are used in the player:

Prop Type Default Example
accent string"#FF620C""#FF00FF"More Info
base string"#000000""#FF00FF"More Info
text string"#FFFFFF""#FF00FF"More Info

Learn more about the color scheme options and how they’re used on the Cloudinary docs.

The logo prop gives the option to customize the player’s logo.

logo defaults to true, showing the Cloudinary logo and linking to https://cloudinary.com when clicked.

When logo is set to false, no logo will be displayed.

To customize the logo, the following options are available in the form of an object:

Prop Type Default Example
imageUrl string https://.../image.jpgMore Info
onClickUrl string https://spacejelly.devMore Info

Poster

The poster prop optionally takes a string or object to customize the generated poster.

When passing a string, you can either pass a Cloudinary Public ID or a remote URL to rendered the desired image.

When passing an object, use same configuration and API as getCldImageUrl to customize the image. You can either specify a src option with a custom public ID or omit the src, which will use the video’s ID to render an automatically generated preview image.

View examples.

Transformations

Prop Type Default Example
sourceTransformation object- More Info
transformation object | array | string-{ width: 200, height: 200, crop: 'fill' }More Info

Advanced

Ads & Analytics

Prop Type Default Example
ads object- More Info
analytics booleanfalsetrueMore Info
allowUsageReport booleantruefalseMore Info
cloudinaryAnalytics booleantruefalseMore Info

Configuration & Delivery

Prop Type Default Example
chapters object-{ 0: "Chapter 1" }More Info
class string my-video-playerAdditional class names added to the video container.
config object-{ url: { cloudName: 'spacejelly' } }More Info
cname string spacejelly.devMore Info
id string my-videoPlayer instance and DOM ID
preload string`auto` More Info
privateCdn boolean trueMore Info
secureDistribution string spacejelly.devMore Info
sourceTypes Array<string>-['hls']More Info
queryParams string/object {myParam: 'value'}More Info
videoJS object- More Info

config

Allows configuration for the Cloudinary environment.

Examples

config={{
cloud: {
cloudName: '<Your Cloud Name>',
}
}}

cname

The custom domain name (CNAME) to use for building URLs, requires secure: false.

Examples

cname = 'spacejelly.dev';

privateCdn

Set this parameter to true if you are an Advanced plan user with a private CDN distribution

Examples

privateCdn={true}

secureDistribution

The custom domain name (CNAME) to use for building URLs, requires secure: true.

Examples

secureDistribution = 'spacejelly.dev';

queryParams

Query parameters to append to video URL.

Examples

queryParams={{
myParam: 'value'
}}

videoJS

Enables you to access all underlying capabilities of the VideoJS API.

Learn more on the VideoJS Docs.

Events

Events are passed in as props rather than using the on:event syntax. Every event current recieves an object with the player and video element:

EventDescription
onErrorFires when an error in video playback occurs
onDataLoadFires when video data is loaded
onMetadataLoadFires when video metadata is loaded
onPauseFires when the video is paused
onPlayFires when the video is played
onEndedFires when the video ends

Localization

You can add custom localization options to control the languages of the player provides labels in.

Prop Type Default Example
language string-ptMore Info
languages object-{ "Play Video": "Reproduzir vídeo" }More Info

Uses Video.js JSON format for localization customization: https://videojs.com/guides/languages/#json-format

Player Behavior

Prop Type Default Example
autoplay string | boolean"never""on-scroll", trueMore Info
autoShowRecommendations booleanfalsetrueMore Info
loop booleanfalsetrueMore Info
maxTries number35More Info
muted booleanfalsetrueMore Info
pictureInPictureToggle booleanfalsetrueMore Info
playedEventPercents Array<number>[25, 50, 75, 100][20, 40, 60, 80, 100]More Info
playedEventTimes Array<number> | nullnull[30, 60]More Info
playsinline booleanfalsetrueMore Info
videoTimeout number5500060000More Info
withCredentials booleanfalsetrueMore Info