Skip to content

Commit 942f6eb

Browse files
authored
fix: set poster-true only if no poster-options provided (#972)
1 parent f29014e commit 942f6eb

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

src/config/defaults.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ export default {
1919
textTrackSettings: false,
2020
loop: false,
2121
muted: false,
22-
poster: true,
2322
posterOptions: {},
2423
sourceTypes: ['auto'],
2524
contextMenu: {

src/plugins/cloudinary/index.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import {
66
normalizeOptions,
77
mergeTransformations,
88
extendCloudinaryConfig,
9-
setupCloudinaryMiddleware
9+
setupCloudinaryMiddleware,
10+
isRawUrl
1011
} from './common';
1112
import VideoSource from './models/video-source/video-source';
1213
import EventHandlerRegistry from './event-handler-registry';
@@ -127,12 +128,21 @@ class CloudinaryContext {
127128

128129
const defaultPosterOptions = posterOptionsForCurrent();
129130
const userPosterOptions = options.posterOptions;
130-
options.poster = options.poster || defaultPosterOptions;
131+
const hasUserPosterOptions = userPosterOptions && Object.keys(userPosterOptions).length > 0;
132+
133+
if (options.poster === undefined) {
134+
if (isRawUrl(publicId)) {
135+
options.poster = false;
136+
} else if (!hasUserPosterOptions) {
137+
options.poster = true;
138+
}
139+
}
140+
131141
options.posterOptions = Object.assign(
132142
{},
133143
defaultPosterOptions,
134144
userPosterOptions,
135-
{ hasUserPosterOptions: !!userPosterOptions || null }
145+
{ hasUserPosterOptions: hasUserPosterOptions || null }
136146
);
137147

138148
options.queryParams = Object.assign(options.queryParams || {}, options.allowUsageReport ? { _s: `vp-${VERSION}` } : {});

src/plugins/cloudinary/models/video-source/video-source.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class VideoSource extends BaseSource {
3939
options.resource_type = options.resourceType;
4040
}
4141

42-
if (!options.poster) {
42+
if (options.poster === undefined) {
4343
options.poster = Object.assign({ publicId }, DEFAULT_POSTER_PARAMS);
4444
}
4545

0 commit comments

Comments
 (0)