Jump to content

Video


dacatchman
 Share

Recommended Posts

So older pixi had a movieclip, but newer docs show to use AnimatedSprite.  Problem is, the construct an animated sprite we need an array of textures.  However, all the demos for v4 and v5 for video are just PIXI.Texture.from('path/to/video') and it makes a new texture/sprite each time the video would play.

I'm interested in using the animatedSprite loop/gotoAndPlay methods because  I'm trying to show videos on demand.  Any ideas?  I'm quite new to PIXI so it's innards and how to get like, the frames of a Texture and such, are a mystery to me.

Thanks!

Link to comment
Share on other sites

Okay, small update.  I figured that I could access the HTML video object directly by going down the object chain, which I can, ie:

mySpriteVideo._texture.baseTexture.source.play();

Generally we treat _variables as private, so it feels wrong to do it this way; any other ideas?  This can't be what the developers of PIXI intended?

Any reason we can't get a PIXI.Video with frame control on it?

Link to comment
Share on other sites

create a variable videoControler,  and ref the baseTexture.source, you should have access to what you want for control the video , also add custom update.
 

    create_IntroVideo () {
        const videoSprite = new PIXI.Sprite( PIXI.Texture.fromVideo( $loader.DATA2.vidA1.data ) );
        const videoControler = videoSprite.texture.baseTexture.source;
        //videoSprite.anchor.set(0.5,1)
        //videoSprite.width = 1920;
        //videoSprite.height = 1080;
        //
        videoControler.currentTime = 11; //temp jump to end
        //videoControler.onended = () => {
            // //  $stage.goto('Scene_Title');
        //}

you have the full api here
https://www.w3schools.com/tags/ref_av_dom.asp

Link to comment
Share on other sites

Thanks for the reply.  In Chrome v76, I am getting this randomly when using videos:

Quote

WebGL: INVALID_VALUE: tex(Sub)Image2D: video visible size is empty

Sometimes it happens, sometimes it doesn't.  Just sitting there refreshing the page sometimes the video plays and other times I get those errors in the console and no video.  Any ideas?

 

 

Link to comment
Share on other sites

AnimatedSprite and videos aren't compatible. One is a sequence of textures, maybe packed with texturePacker. Another is an html <video> streaming to texture, and it gives you much less control and more problems. As for chrome v76, we made a fix for that: https://github.com/pixijs/pixi.js/pull/6088 , here's the build: pixijs.download/fix-video-performance/pixi.js

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...