Skip to content

Commit 29f5aca

Browse files
committed
Added all of the Video Events and completed the jsdocs
1 parent 0958df8 commit 29f5aca

12 files changed

Lines changed: 371 additions & 55 deletions
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/**
2+
* @author Richard Davey <rich@photonstorm.com>
3+
* @copyright 2019 Photon Storm Ltd.
4+
* @license {@link https://opensource.org/licenses/MIT|MIT License}
5+
*/
6+
7+
/**
8+
* The Video Game Object Complete Event.
9+
*
10+
* This event is dispatched when a Video finishes playback by reaching the end of its duration. It
11+
* is also dispatched if a video marker sequence is being played and reaches the end.
12+
*
13+
* Note that not all videos can fire this event. Live streams, for example, have no fixed duration,
14+
* so never technically 'complete'.
15+
*
16+
* If a video is stopped from playback, via the `Video.stop` method, it will emit the
17+
* `VIDEO_STOP` event instead of this one.
18+
*
19+
* Listen for it from a Video Game Object instance using `Video.on('complete', listener)`.
20+
*
21+
* @event Phaser.GameObjects.Events#VIDEO_COMPLETE
22+
* @since 3.20.0
23+
*
24+
* @param {Phaser.GameObjects.Video} video - The Video Game Object which completed playback.
25+
*/
26+
module.exports = 'complete';
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* @author Richard Davey <rich@photonstorm.com>
3+
* @copyright 2019 Photon Storm Ltd.
4+
* @license {@link https://opensource.org/licenses/MIT|MIT License}
5+
*/
6+
7+
/**
8+
* The Video Game Object Created Event.
9+
*
10+
* This event is dispatched when the texture for a Video has been created. This happens
11+
* when enough of the video source has been loaded that the browser is able to render a
12+
* frame from it.
13+
*
14+
* Listen for it from a Video Game Object instance using `Video.on('created', listener)`.
15+
*
16+
* @event Phaser.GameObjects.Events#VIDEO_CREATED
17+
* @since 3.20.0
18+
*
19+
* @param {Phaser.GameObjects.Video} video - The Video Game Object which raised the event.
20+
* @param {integer} width - The width of the video.
21+
* @param {integer} height - The height of the video.
22+
*/
23+
module.exports = 'created';
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/**
2+
* @author Richard Davey <rich@photonstorm.com>
3+
* @copyright 2019 Photon Storm Ltd.
4+
* @license {@link https://opensource.org/licenses/MIT|MIT License}
5+
*/
6+
7+
/**
8+
* The Video Game Object Error Event.
9+
*
10+
* This event is dispatched when a Video tries to play a source that does not exist, or is the wrong file type.
11+
*
12+
* Listen for it from a Video Game Object instance using `Video.on('error', listener)`.
13+
*
14+
* @event Phaser.GameObjects.Events#VIDEO_ERROR
15+
* @since 3.20.0
16+
*
17+
* @param {Phaser.GameObjects.Video} video - The Video Game Object which threw the error.
18+
* @param {Event} event - The native DOM event the browser raised during playback.
19+
*/
20+
module.exports = 'error';
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/**
2+
* @author Richard Davey <rich@photonstorm.com>
3+
* @copyright 2019 Photon Storm Ltd.
4+
* @license {@link https://opensource.org/licenses/MIT|MIT License}
5+
*/
6+
7+
/**
8+
* The Video Game Object Loop Event.
9+
*
10+
* This event is dispatched when a Video that is currently playing has looped. This only
11+
* happens if the `loop` parameter was specified, or the `setLoop` method was called,
12+
* and if the video has a fixed duration. Video streams, for example, cannot loop, as
13+
* they have no duration.
14+
*
15+
* Looping is based on the result of the Video `timeupdate` event. This event is not
16+
* frame-accurate, due to the way browsers work, so please do not rely on this loop
17+
* event to be time or frame precise.
18+
*
19+
* Listen for it from a Video Game Object instance using `Video.on('loop', listener)`.
20+
*
21+
* @event Phaser.GameObjects.Events#VIDEO_LOOP
22+
* @since 3.20.0
23+
*
24+
* @param {Phaser.GameObjects.Video} video - The Video Game Object which has looped.
25+
*/
26+
module.exports = 'loop';
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* @author Richard Davey <rich@photonstorm.com>
3+
* @copyright 2019 Photon Storm Ltd.
4+
* @license {@link https://opensource.org/licenses/MIT|MIT License}
5+
*/
6+
7+
/**
8+
* The Video Game Object Play Event.
9+
*
10+
* This event is dispatched when a Video begins playback. For videos that do not require
11+
* interaction unlocking, this is usually as soon as the `Video.play` method is called.
12+
* However, for videos that require unlocking, it is fired once playback begins after
13+
* they've been unlocked.
14+
*
15+
* Listen for it from a Video Game Object instance using `Video.on('play', listener)`.
16+
*
17+
* @event Phaser.GameObjects.Events#VIDEO_PLAY
18+
* @since 3.20.0
19+
*
20+
* @param {Phaser.GameObjects.Video} video - The Video Game Object which started playback.
21+
*/
22+
module.exports = 'play';
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* @author Richard Davey <rich@photonstorm.com>
3+
* @copyright 2019 Photon Storm Ltd.
4+
* @license {@link https://opensource.org/licenses/MIT|MIT License}
5+
*/
6+
7+
/**
8+
* The Video Game Object Seeked Event.
9+
*
10+
* This event is dispatched when a Video completes seeking to a new point in its timeline.
11+
*
12+
* Listen for it from a Video Game Object instance using `Video.on('seeked', listener)`.
13+
*
14+
* @event Phaser.GameObjects.Events#VIDEO_SEEKED
15+
* @since 3.20.0
16+
*
17+
* @param {Phaser.GameObjects.Video} video - The Video Game Object which completed seeking.
18+
*/
19+
module.exports = 'seeked';
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/**
2+
* @author Richard Davey <rich@photonstorm.com>
3+
* @copyright 2019 Photon Storm Ltd.
4+
* @license {@link https://opensource.org/licenses/MIT|MIT License}
5+
*/
6+
7+
/**
8+
* The Video Game Object Seeking Event.
9+
*
10+
* This event is dispatched when a Video _begins_ seeking to a new point in its timeline.
11+
* When the seek is complete, it will dispatch the `VIDEO_SEEKED` event to conclude.
12+
*
13+
* Listen for it from a Video Game Object instance using `Video.on('seeking', listener)`.
14+
*
15+
* @event Phaser.GameObjects.Events#VIDEO_SEEKING
16+
* @since 3.20.0
17+
*
18+
* @param {Phaser.GameObjects.Video} video - The Video Game Object which started seeking.
19+
*/
20+
module.exports = 'seeking';
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/**
2+
* @author Richard Davey <rich@photonstorm.com>
3+
* @copyright 2019 Photon Storm Ltd.
4+
* @license {@link https://opensource.org/licenses/MIT|MIT License}
5+
*/
6+
7+
/**
8+
* The Video Game Object Stopped Event.
9+
*
10+
* This event is dispatched when a Video is stopped from playback via a call to the `Video.stop` method,
11+
* either directly via game code, or indirectly as the result of changing a video source or destroying it.
12+
*
13+
* Listen for it from a Video Game Object instance using `Video.on('stop', listener)`.
14+
*
15+
* @event Phaser.GameObjects.Events#VIDEO_STOP
16+
* @since 3.20.0
17+
*
18+
* @param {Phaser.GameObjects.Video} video - The Video Game Object which stopped playback.
19+
*/
20+
module.exports = 'stop';
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/**
2+
* @author Richard Davey <rich@photonstorm.com>
3+
* @copyright 2019 Photon Storm Ltd.
4+
* @license {@link https://opensource.org/licenses/MIT|MIT License}
5+
*/
6+
7+
/**
8+
* The Video Game Object Timeout Event.
9+
*
10+
* This event is dispatched when a Video has exhausted its allocated time while trying to connect to a video
11+
* source to start playback.
12+
*
13+
* Listen for it from a Video Game Object instance using `Video.on('timeout', listener)`.
14+
*
15+
* @event Phaser.GameObjects.Events#VIDEO_TIMEOUT
16+
* @since 3.20.0
17+
*
18+
* @param {Phaser.GameObjects.Video} video - The Video Game Object which timed out.
19+
*/
20+
module.exports = 'timeout';
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/**
2+
* @author Richard Davey <rich@photonstorm.com>
3+
* @copyright 2019 Photon Storm Ltd.
4+
* @license {@link https://opensource.org/licenses/MIT|MIT License}
5+
*/
6+
7+
/**
8+
* The Video Game Object Unlocked Event.
9+
*
10+
* This event is dispatched when a Video that was prevented from playback due to the browsers
11+
* Media Engagement Interaction policy, is unlocked by a user gesture.
12+
*
13+
* Listen for it from a Video Game Object instance using `Video.on('unlocked', listener)`.
14+
*
15+
* @event Phaser.GameObjects.Events#VIDEO_UNLOCKED
16+
* @since 3.20.0
17+
*
18+
* @param {Phaser.GameObjects.Video} video - The Video Game Object which raised the event.
19+
*/
20+
module.exports = 'unlocked';

0 commit comments

Comments
 (0)