1
0
mirror of https://github.com/videojs/video.js.git synced 2025-02-08 12:05:47 +02:00

feat(cors): allow both crossOrigin and crossorigin method and options (#6571)

Fixes a bug with the setter and aliases crossorigin to crossOrigin.

This is a followup from #6533.
This commit is contained in:
Gary Katsevman 2020-04-06 13:04:22 -04:00 committed by GitHub
parent ea20edcd99
commit f711ddcfb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -744,7 +744,8 @@ class Player extends Component {
this.fill(this.options_.fill);
this.fluid(this.options_.fluid);
this.aspectRatio(this.options_.aspectRatio);
this.crossOrigin(this.options_.crossOrigin);
// support both crossOrigin and crossorigin to reduce confusion and issues around the name
this.crossOrigin(this.options_.crossOrigin || this.options_.crossorigin);
// Hide any links within the video/audio tag,
// because IE doesn't hide them completely from screen readers.
@ -803,7 +804,7 @@ class Player extends Component {
return this.techGet_('crossOrigin');
}
if (value !== 'anonymous' || value !== 'use-credentials') {
if (value !== 'anonymous' && value !== 'use-credentials') {
log.warn(`crossOrigin must be "anonymous" or "use-credentials", given "${value}"`);
return;
}
@ -4778,6 +4779,23 @@ TRACK_TYPES.names.forEach(function(name) {
};
});
/**
* Get or set the `Player`'s crossorigin option. For the HTML5 player, this
* sets the `crossOrigin` property on the `<video>` tag to control the CORS
* behavior.
*
* @see [Video Element Attributes]{@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video#attr-crossorigin}
*
* @param {string} [value]
* The value to set the `Player`'s crossorigin to. If an argument is
* given, must be one of `anonymous` or `use-credentials`.
*
* @return {string|undefined}
* - The current crossorigin value of the `Player` when getting.
* - undefined when setting
*/
Player.prototype.crossorigin = Player.prototype.crossOrigin;
/**
* Global enumeration of players.
*