Skip to content

Commit ed1fbef

Browse files
committed
fix: make video-config configurable
1 parent 2dfb862 commit ed1fbef

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

src/config/configSchema.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,10 @@
526526
"enum": ["fastStart", "balanced", "highQuality"],
527527
"default": "balanced"
528528
},
529+
"videoConfig": {
530+
"type": "boolean",
531+
"default": true
532+
},
529533
"videoSources": {
530534
"type": "array",
531535
"items": {

src/config/defaults.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export default {
2929
analytics: false,
3030
cloudinaryAnalytics: true,
3131
allowUsageReport: true,
32+
videoConfig: true,
3233
playedEventPercents: [25, 50, 75, 100],
3334
adaptiveStreaming: {
3435
strategy: 'balanced',

src/utils/fetch-config.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,20 @@ const getDefaultProfileConfig = (profileName) => {
1515
};
1616

1717
const fetchConfig = async (options) => {
18-
const { profile, publicId, cloudinaryConfig, type = 'upload' } = options;
18+
const { profile, publicId, cloudinaryConfig, type = 'upload', videoConfig } = options;
1919

2020
if (profile && isDefaultProfile(profile)) {
2121
return getDefaultProfileConfig(profile);
2222
}
2323

2424
const urlPrefix = getCloudinaryUrlPrefix(cloudinaryConfig) + '/_applet_/video_service';
2525

26-
2726
let configUrl;
2827
if (profile) {
2928
configUrl = isRawUrl(profile)
3029
? profile
3130
: `${urlPrefix}/video_player_profiles/${profile.replaceAll(' ', '+')}.json`;
32-
} else if (publicId) {
31+
} else if (publicId && videoConfig !== false) {
3332
configUrl = `${urlPrefix}/video_player_config/video/${type}/${utf8ToBase64(publicId)}.json`;
3433
} else {
3534
return {};
@@ -53,7 +52,7 @@ export const fetchAndMergeConfig = async (options) => {
5352
...(options.profile ? {
5453
profile: isDefaultProfile(options.profile) ? options.profile : true
5554
} : {}),
56-
...(!options.profile && options.publicId ? {
55+
...(!options.profile && options.videoConfig !== false && options.publicId ? {
5756
videoConfig: true
5857
} : {}),
5958
...(fetchedConfig.length > 0 ? {

src/video-player.const.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export const PLAYER_PARAMS = SOURCE_PARAMS.concat([
5454
'queryParams',
5555
'seekThumbnails',
5656
'showJumpControls',
57+
'videoConfig',
5758
]);
5859

5960
// We support both camelCase and snake_case for cloudinary SDK params

0 commit comments

Comments
 (0)