Skip to content

Commit 393b2e1

Browse files
committed
feat: removing autoPlay prop (with capital p) in favor of autoplay
1 parent 2e4f7e1 commit 393b2e1

File tree

1 file changed

+10
-17
lines changed

1 file changed

+10
-17
lines changed

next-cloudinary/src/components/CldVideoPlayer/CldVideoPlayer.tsx

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ const PLAYER_VERSION = '1.10.4';
1616
const CldVideoPlayer = (props: CldVideoPlayerProps) => {
1717

1818
const {
19-
autoPlay, // Left behind for backward compactibility.
2019
autoplay,
2120
className,
2221
colors,
@@ -86,7 +85,7 @@ const CldVideoPlayer = (props: CldVideoPlayerProps) => {
8685
const checkForMultipleInstance = playerInstances.filter((id) => id === playerId).length > 1
8786
if (checkForMultipleInstance) {
8887
console.warn(`Multiple instances of the same video detected on the
89-
page which may cause some features to not work.
88+
page which may cause some features to not work.
9089
Try adding a unique id to each player.`)
9190
} else {
9291
playerInstances.push(playerId)
@@ -138,25 +137,19 @@ const CldVideoPlayer = (props: CldVideoPlayerProps) => {
138137
}
139138
}
140139

141-
/*
142-
Parse the value passed to 'autoplay' or 'autoPlay';
143-
if its a boolean or a boolean passed as string ("true") set it directly to browser standard prop autoplay else fallback to default;
144-
if its a string and not a boolean passed as string ("true") set it to cloudinary video player autoplayMode prop else fallback to undefined;
145-
*/
146-
const autoplayFallback = autoplay || autoPlay ;
140+
// Parse the value passed to 'autoplay';
141+
// if its a boolean or a boolean passed as string ("true") set it directly to browser standard prop autoplay else fallback to default;
142+
// if its a string and not a boolean passed as string ("true") set it to cloudinary video player autoplayMode prop else fallback to undefined;
143+
147144
let autoPlayValue: boolean | 'true' | 'false' = false;
148145
let autoplayModeValue: string | undefined = undefined;
149146

150-
if ( autoPlay && process.env.NODE_ENV === 'development' ) {
151-
console.warn('Prop autoPlay will be removed in future versions, please use autoplay (lowercase "p")')
152-
}
153-
154-
if (typeof autoplayFallback === 'boolean' || autoplayFallback === 'true' || autoplayFallback === 'false') {
155-
autoPlayValue = autoplayFallback
147+
if (typeof autoplay === 'boolean' || autoplay === 'true' || autoplay === 'false') {
148+
autoPlayValue = autoplay
156149
}
157150

158-
if (typeof autoplayFallback === 'string' && autoplayFallback !== 'true' && autoplayFallback !== 'false') {
159-
autoplayModeValue = autoplayFallback;
151+
if (typeof autoplay === 'string' && autoplay !== 'true' && autoplay !== 'false') {
152+
autoplayModeValue = autoplay;
160153
}
161154

162155

@@ -194,7 +187,7 @@ const CldVideoPlayer = (props: CldVideoPlayerProps) => {
194187
// If poster is an object, we can either customize the
195188
// automatically generated image from the video or generate
196189
// a completely new image from a separate public ID, so look
197-
// to see if the src is explicitly set to determine whether
190+
// to see if the src is explicitly set to determine whether
198191
// or not to use the video's ID or just pass things along
199192
if ( typeof poster.src !== 'string' ) {
200193
playerOptions.posterOptions = {

0 commit comments

Comments
 (0)