pierre290177 Posted November 4, 2019 Share Posted November 4, 2019 hi, I'm completely new to pixi.js and i have trouble to replace a video by another video in my canvas. i wrote this code to launch the first video : const video = PIXI.Texture.from('img/dc.mp4'); far = new PIXI.extras.TilingSprite(video, 1920, 1080); stage.addChild(far); .... and when i want to replace this video i used this : video.destroy(true); far.destroy(true); var video2 = PIXI.Texture.fromVideo('img/sd9.mp4'); far = new PIXI.extras.TilingSprite(video2, 1920, 1080); stage.addChild(far); it works but i ve some errors in the console : it say : TypeError: this.source is null TypeError: null has no properties and the number of this last error is growing in time ; Can someone explain me what is wrong and what should i do to resolve those errors. i don't know if there is a more simple way to update the video. Thanks, Pierre Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted November 4, 2019 Share Posted November 4, 2019 far.texture = PIXI.Texture.fromVideo('img/sd9.mp4'); That'll work too. Regarding your current problem, it looks like double-destroy Destroy the same thing twice somehow, you can debug it with chrome devtools. PixiJS doesnt have any guarantees against it, its open-source library and not some huge monster adobe product with a hundred people working on it constantly pierre290177 1 Quote Link to comment Share on other sites More sharing options...
jonforum Posted November 5, 2019 Share Posted November 5, 2019 hum on my side here how i proceed for be sure my video is destroyed and clear. //if your ref your video controler like this . this.videoControler = videoSprite.texture.baseTexture.source; //then destroy after pixi this.videoControler.pause(); this.videoControler.remove(); this.videoControler.load(); Quote Link to comment Share on other sites More sharing options...
pierre290177 Posted November 6, 2019 Author Share Posted November 6, 2019 (edited) On 11/5/2019 at 12:13 AM, ivan.popelyshev said: far.texture = PIXI.Texture.fromVideo('img/sd9.mp4'); That'll work too. Regarding your current problem, it looks like double-destroy Destroy the same thing twice somehow, you can debug it with chrome devtools. PixiJS doesnt have any guarantees against it, its open-source library and not some huge monster adobe product with a hundred people working on it constantly thanks a lot it work. i have no error anymore. Edited November 6, 2019 by pierre290177 ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted November 6, 2019 Share Posted November 6, 2019 just dont forget to destroy old texture if you aren't gonna use it anymore, for video its important. "far.texture.destroy(true); far.texture = PIXI.Texture.fromVideo('img/sd9.mp4)" Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted November 6, 2019 Share Posted November 6, 2019 Welcome to the forums! Congratulations with first thread. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.