hatem.ismail Posted November 12, 2015 Share Posted November 12, 2015 Dears, kindly I need help phaser issue on working on videos objectshere is my game code exmple:var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create});function preload() { game.load.video('video', 'http://crossorigin.me/http://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_1mb.mp4');}var video;function create() { video = game.add.video('video', 0.5, 0.5); video.play(true); video.addToWorld(0, 0, 0.5, 0.5); setTimeout(function(){ video.destroy(); }, 3000);}when try call destroy() method return error: Uncaught TypeError: Cannot read property 'paused' of null also I properties like video.visible = false, or change x, y position not effective here is full code on jsfiddle:http://jsfiddle.net/hatem_ismail/uv6cqebj/1/ Thank you Link to comment Share on other sites More sharing options...
harry830622 Posted January 9, 2016 Share Posted January 9, 2016 Same here!!! Link to comment Share on other sites More sharing options...
harry830622 Posted January 10, 2016 Share Posted January 10, 2016 But I found that you can use video sprite as an alternative. Then the problem solved, since you can easily destroy a sprite. Link to comment Share on other sites More sharing options...
iambaz Posted September 14, 2016 Share Posted September 14, 2016 I'm getting this error also. Can someone explain what the above poster means by ''use video sprite as an alternative'? Thanks Link to comment Share on other sites More sharing options...
samme Posted September 14, 2016 Share Posted September 14, 2016 You can't destroy a Video while it's still being used as a texture by an Image or Sprite. You should save a reference from `addToWorld` (which is the Image using the video) then, if you want, destroy the Image first and then the Video. var video = game.add.video('video', 0.5, 0.5); video.play(true); var videoImage = video.addToWorld(0, 0); game.time.events.add(3000, function() { videoImage.destroy(); video.destroy(); }); juandelossantos and iambaz 2 Link to comment Share on other sites More sharing options...
iambaz Posted September 14, 2016 Share Posted September 14, 2016 Ok, if anyone stumbles across this, the problem was that I was trying to call destroy() on the initial object reference. You can call it on what is returned from 'addToWorld()' EG: var mov = game.add.video('myVideo'); var txt = mov.addToWorld(0, 0); mov.onComplete.add(function(obj){ txt.destroy(); }); Link to comment Share on other sites More sharing options...
Recommended Posts