Skip to content

Commit

Permalink
Merge pull request #676 from jorginius/video-crossorigin
Browse files Browse the repository at this point in the history
crossorigin attribute on video
  • Loading branch information
samme authored Jul 28, 2020
2 parents 74deea8 + d4f6784 commit f328883
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/gameobjects/Video.js
Original file line number Diff line number Diff line change
Expand Up @@ -550,9 +550,10 @@ Phaser.Video.prototype = {
* @method Phaser.Video#createVideoFromURL
* @param {string} url - The URL of the video.
* @param {boolean} [autoplay=false] - Automatically start the video?
* @param {string} crossOrigin - The crossorigin parameter provides support for CORS
* @return {Phaser.Video} This Video object for method chaining.
*/
createVideoFromURL: function (url, autoplay)
createVideoFromURL: function (url, autoplay, crossOrigin)
{
if (autoplay === undefined) { autoplay = false; }

Expand All @@ -570,6 +571,11 @@ Phaser.Video.prototype = {
this.video.setAttribute('autoplay', 'autoplay');
}

if (crossOrigin !== undefined)
{
this.video.crossOrigin = crossOrigin;
}

this.video.setAttribute('playsinline', 'playsinline');

this.video.src = url;
Expand Down
2 changes: 1 addition & 1 deletion typescript/phaser.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3137,7 +3137,7 @@ declare module Phaser {
addToWorld(x?: number, y?: number, anchorX?: number, anchorY?: Number, scaleX?: number, scaleY?: number): Phaser.Image;
createVideoFromBlob(blob: Blob): Phaser.Video;
startMediaStream(captureAudio?: boolean, width?: number, height?: number): Phaser.Video;
createVideoFromURL(url: string, autoplay?: boolean): Phaser.Video;
createVideoFromURL(url: string, autoplay?: boolean, crossOrigin?: string): Phaser.Video;
changeSource(src: string, autoplay?: boolean): Phaser.Video;
connectToMediaStram(video: any, stream: any): Phaser.Video;
destroy(): void;
Expand Down

0 comments on commit f328883

Please sign in to comment.