mirror of
https://github.com/photonstorm/phaser
synced 2024-11-29 16:10:56 +00:00
Merge pull request #5788 from martell-ventures/loadURL_crossorigin
Add Crossorigin support
This commit is contained in:
commit
da3e8b5a25
1 changed files with 6 additions and 1 deletions
|
@ -811,10 +811,11 @@ var Video = new Class({
|
|||
* @param {string} url - The URL of the video to load or be streamed.
|
||||
* @param {string} [loadEvent='loadeddata'] - The load event to listen for. Either `loadeddata`, `canplay` or `canplaythrough`.
|
||||
* @param {boolean} [noAudio=false] - Does the video have an audio track? If not you can enable auto-playing on it.
|
||||
* @param {string} [crossOrigin] - The value to use for the `crossOrigin` property in the video load request. Either undefined, `anonymous` or `use-credentials`
|
||||
*
|
||||
* @return {this} This Video Game Object for method chaining.
|
||||
*/
|
||||
loadURL: function (url, loadEvent, noAudio)
|
||||
loadURL: function (url, loadEvent, noAudio, crossOrigin)
|
||||
{
|
||||
if (loadEvent === undefined) { loadEvent = 'loadeddata'; }
|
||||
if (noAudio === undefined) { noAudio = false; }
|
||||
|
@ -844,6 +845,10 @@ var Video = new Class({
|
|||
video.setAttribute('playsinline', 'playsinline');
|
||||
video.setAttribute('preload', 'auto');
|
||||
|
||||
if(crossOrigin !== undefined) {
|
||||
video.setAttribute('crossorigin', crossOrigin);
|
||||
}
|
||||
|
||||
video.addEventListener('error', this._callbacks.error, true);
|
||||
|
||||
video.src = url;
|
||||
|
|
Loading…
Reference in a new issue