mirror of
https://github.com/photonstorm/phaser
synced 2024-11-16 01:38:23 +00:00
Added video loadeddata callback for Firefox (which doesn't throw the canplay event until you actually start to play the video.. awesome, thanks Firefox)
This commit is contained in:
parent
ad4cf34d05
commit
71b242386d
1 changed files with 15 additions and 0 deletions
|
@ -2049,7 +2049,19 @@ Phaser.Loader.prototype = {
|
|||
var playThroughEvent = function () {
|
||||
file.data.removeEventListener('canplay', playThroughEvent, false);
|
||||
file.data.removeEventListener('canplaythrough', playThroughEvent, false);
|
||||
file.data.removeEventListener('loadeddata', playThroughEvent, false);
|
||||
file.data.onerror = null;
|
||||
file.data.canplay = true;
|
||||
// Why does this cycle through games?
|
||||
Phaser.GAMES[_this.game.id].load.fileComplete(file);
|
||||
};
|
||||
|
||||
var loadedDataEvent = function () {
|
||||
file.data.removeEventListener('canplay', playThroughEvent, false);
|
||||
file.data.removeEventListener('canplaythrough', playThroughEvent, false);
|
||||
file.data.removeEventListener('loadeddata', loadedDataEvent, false);
|
||||
file.data.onerror = null;
|
||||
file.data.canplay = false;
|
||||
// Why does this cycle through games?
|
||||
Phaser.GAMES[_this.game.id].load.fileComplete(file);
|
||||
};
|
||||
|
@ -2057,7 +2069,9 @@ Phaser.Loader.prototype = {
|
|||
file.data.onerror = function () {
|
||||
file.data.removeEventListener('canplay', playThroughEvent, false);
|
||||
file.data.removeEventListener('canplaythrough', playThroughEvent, false);
|
||||
file.data.removeEventListener('loadeddata', playThroughEvent, false);
|
||||
file.data.onerror = null;
|
||||
file.data.canplay = false;
|
||||
_this.fileError(file);
|
||||
};
|
||||
|
||||
|
@ -2065,6 +2079,7 @@ Phaser.Loader.prototype = {
|
|||
file.data.autoplay = false;
|
||||
file.data.addEventListener('canplay', playThroughEvent, false);
|
||||
file.data.addEventListener('canplaythrough', playThroughEvent, false);
|
||||
file.data.addEventListener('loadeddata', loadedDataEvent, false);
|
||||
file.data.src = this.transformUrl(file.url, file);
|
||||
file.data.load();
|
||||
|
||||
|
|
Loading…
Reference in a new issue