Skip to content

Commit

Permalink
fix: withCredentials (ME-16117) (#607)
Browse files Browse the repository at this point in the history
* fix: withCredentials

* fix: withCredentials in playerConfig as documented
  • Loading branch information
tsi authored Apr 9, 2024
1 parent 6034c79 commit 31e4cbe
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/plugins/cloudinary/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,10 @@ const setupCloudinaryMiddleware = () => {
videojs.use('video/auto', () => {
return {
async setSource(srcObj, next) {
const { headers } = await fetch(srcObj.src, { method: 'HEAD' });
const { headers } = await fetch(srcObj.src, {
method: 'HEAD',
credentials: srcObj.withCredentials ? 'include' : 'omit'
});

return next(null, {
src: srcObj.src,
Expand Down
2 changes: 1 addition & 1 deletion src/validators/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export const playerValidators = {
queryParams: validator.isPlainObject,
publicId: validator.isString,
fluid: validator.isBoolean,
withCredentials: validator.isBoolean,
analytics: validator.isBoolean,
cloudinaryAnalytics: validator.isBoolean,
hideContextMenu: validator.isBoolean,
Expand Down Expand Up @@ -84,7 +85,6 @@ export const playerValidators = {
export const sourceValidators = {
raw_transformation: validator.isString,
shoppable: validator.isPlainObject,
withCredentials: validator.isBoolean,
chapters: validator.or(validator.isBoolean, validator.isPlainObject),
interactionAreas: {
enable: validator.isBoolean,
Expand Down
4 changes: 4 additions & 0 deletions src/video-player.js
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,10 @@ class VideoPlayer extends Utils.mixin(Eventable) {
options.usageReport = true;
}

if (this.playerOptions.withCredentials) {
options.withCredentials = true;
}

clearTimeout(this.reTryId);
this.nbCalls = 0;
const maxTries = this.videojs.options_.maxTries || 3;
Expand Down

0 comments on commit 31e4cbe

Please sign in to comment.