Jump to content

PIXI cache on repeated loads?


charlie_says
 Share

Recommended Posts

Hi,

I'm certain there will be a way of doing this, but having looked through the docs I'm not seeing the answer...

I'm loading some videos like this:

const videoPathAndName: string = pathTo+'video/'+level+'/video/'+name;

let videotexture = PIXI.VideoBaseTexture.fromUrls([
	{ src: videoPathAndName+'.webm', mime: 'video/webm' },
	{ src: videoPathAndName+'.mp4', mime: 'video/mp4' },
	{ src: videoPathAndName+'.ogv', mime: 'video/ogv' }
]);
videotexture.autoPlay = false;

this._texture = new PIXI.Texture(videotexture);

this._texture.baseTexture.on('loaded',this._checkLoaded);

which works fine.

But, what I wondered was: as I repeat various sections  whether I could check whether the video was already in the cache before trying to load? This would save repeated loads.

Or does the loader handle this already?

Thanks!

 

 

 

 

Link to comment
Share on other sites

Yeah, that was a wrong turn, although, you should be able to add videos from an element using

PIXI.VideoBaseTexture.fromVideo()

I'd hoped to add an id to the DOM element, and then reuse it... (didn't get it to work obviously)

Adding a reference to the baseTexture cache then allows me to retrieve it later

PIXI.utils.BaseTextureCache[this._videoName] = this._videoTexture.baseTexture;
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...