mirror of
https://github.com/photonstorm/phaser
synced 2024-11-14 00:47:29 +00:00
Added type
parameter to VideoTexture.fromUrl
allowing you to define the mime-type of the video file, which is required for Firefox and Safari in most cases.
This commit is contained in:
parent
4c0e34e788
commit
e291f6d590
2 changed files with 9 additions and 5 deletions
|
@ -298,6 +298,7 @@ Version 2.4 - "Katar" - in dev
|
|||
* SoundManager.pauseAll, resumeAll and stopAll now checks if the SoundManager.noAudio is set and ignores the calls.
|
||||
* SoundManager.usingWebAudio is set to `false` by default (used to be `true`) and is only explicitly set if Web Audio is available and hasn't been disabled in the PhaserGlobal object.
|
||||
* SoundManager.touchLocked is now set to `false` should the device be using legacy Audio, avoiding the unlock call running without need.
|
||||
* Added `type` parameter to `VideoTexture.fromUrl` allowing you to define the mime-type of the video file, which is required for Firefox and Safari in most cases.
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
|
|
|
@ -77,13 +77,13 @@ PIXI.VideoTexture.prototype.stop = function()
|
|||
}
|
||||
};
|
||||
|
||||
PIXI.VideoTexture.prototype._onEnded = function()
|
||||
PIXI.VideoTexture.prototype._onEnded = function(event)
|
||||
{
|
||||
this.ended = true;
|
||||
this.onComplete.dispatch();
|
||||
};
|
||||
|
||||
PIXI.VideoTexture.prototype._onUpdate = function()
|
||||
PIXI.VideoTexture.prototype._onUpdate = function(event)
|
||||
{
|
||||
if (this.autoUpdate)
|
||||
{
|
||||
|
@ -107,7 +107,7 @@ PIXI.VideoTexture.prototype.onPlayStop = function()
|
|||
this.autoUpdate = false;
|
||||
};
|
||||
|
||||
PIXI.VideoTexture.prototype.onCanPlay = function()
|
||||
PIXI.VideoTexture.prototype.onCanPlay = function(event)
|
||||
{
|
||||
if (event.type === 'canplaythrough')
|
||||
{
|
||||
|
@ -196,17 +196,20 @@ PIXI.VideoTexture.textureFromVideo = function(video, scaleMode)
|
|||
* @param videoSrc {String} The URL for the video.
|
||||
* @param scaleMode {Number} See {{#crossLink "PIXI/scaleModes:property"}}PIXI.scaleModes{{/crossLink}} for possible values
|
||||
* @param autoPlay {boolean} Automatically start the video playing? Until you do this you can't get the width / height of the resulting texture.
|
||||
* @param type {string} The mime-type of the video to be played. Defaults to "video/mp4". Needed for Firefox and Safari.
|
||||
* @return {VideoTexture}
|
||||
*/
|
||||
PIXI.VideoTexture.fromUrl = function(videoSrc, scaleMode, autoPlay)
|
||||
PIXI.VideoTexture.fromUrl = function(videoSrc, scaleMode, autoPlay, type)
|
||||
{
|
||||
if (typeof scaleMode === 'undefined') { scaleMode = PIXI.scaleModes.DEFAULT; }
|
||||
if (typeof autoPlay === 'undefined') { autoPlay = true; }
|
||||
if (typeof type === 'undefined') { type = "video/mp4"; }
|
||||
|
||||
var video = document.createElement('video');
|
||||
|
||||
video.src = videoSrc;
|
||||
video.controls = true;
|
||||
video.controls = false;
|
||||
video.type = type;
|
||||
|
||||
if (autoPlay)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue