Jump to content

update my video


pierre290177
 Share

Recommended Posts

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(video19201080);
   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(video219201080);
 
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

 

 

 

 

Link to comment
Share on other sites

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 :)

 

Link to comment
Share on other sites

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();

 

Link to comment
Share on other sites

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 by pierre290177
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...