File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -366,6 +366,16 @@ var Video = new Class({
366366 */
367367 this . _isSeeking = false ;
368368
369+ /**
370+ * Should the Video element that this Video is using, be removed from the DOM
371+ * when this Video is destroyed?
372+ *
373+ * @name Phaser.GameObjects.Video#removeVideoElementOnDestroy
374+ * @type {boolean }
375+ * @since 3.21.0
376+ */
377+ this . removeVideoElementOnDestroy = false ;
378+
369379 this . setPosition ( x , y ) ;
370380 this . initPipeline ( ) ;
371381
@@ -1711,22 +1721,21 @@ var Video = new Class({
17111721 } ,
17121722
17131723 /**
1714- * Destroys the Video object. This calls `Video.stop` and optionally `Video.removeVideoElement`.
1724+ * Handles the pre-destroy step for the Video object.
1725+ *
1726+ * This calls `Video.stop` and optionally `Video.removeVideoElement`.
17151727 *
17161728 * If any Sprites are using this Video as their texture it is up to you to manage those.
17171729 *
1718- * @method Phaser.GameObjects.Video#destroy
1719- * @since 3.20.0
1720- *
1721- * @param {boolean } [removeVideoElement=false] - Should the video element be removed from the DOM?
1730+ * @method Phaser.GameObjects.Video#preDestroy
1731+ * @private
1732+ * @since 3.21.0
17221733 */
1723- destroy : function ( removeVideoElement )
1734+ preDestroy : function ( )
17241735 {
1725- if ( removeVideoElement === undefined ) { removeVideoElement = false ; }
1726-
17271736 this . stop ( ) ;
17281737
1729- if ( removeVideoElement )
1738+ if ( this . removeVideoElementOnDestroy )
17301739 {
17311740 this . removeVideoElement ( ) ;
17321741 }
You can’t perform that action at this time.
0 commit comments