charlie_says Posted February 15, 2018 Share Posted February 15, 2018 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! Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted February 15, 2018 Share Posted February 15, 2018 Pixi loader has no connection to "from" methods. Yes, its done through the cache, but in that case (three sources) I dont know whether it works. Please check all the BaseTexture, Texture, VideoBaseTexture, TextureCache (in utils) code sources. May be you have to debug it Quote Link to comment Share on other sites More sharing options...
charlie_says Posted February 15, 2018 Author Share Posted February 15, 2018 hmmm I guess from the repo: github videobasetexture.js That's probably a no then... Quote Link to comment Share on other sites More sharing options...
charlie_says Posted February 15, 2018 Author Share Posted February 15, 2018 Ahh... there may be a way - but, if I load the videos the above way, how can I set it's name in the cache? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted February 15, 2018 Share Posted February 15, 2018 Manually. There're cache-related operation in Texture. I really dont want to look at the code inside, my brains are already full of trash:) Quote Link to comment Share on other sites More sharing options...
charlie_says Posted February 15, 2018 Author Share Posted February 15, 2018 Ha @ivan.popelyshev I hear that! So, I've got an idea, but I can't seem to get it working... I can set an ID to the video tag in the page videotexture.source.id = name; but trying console.log(document.getElementById(name),'<<<<<<<<<<<<<<<<<<') returns null. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted February 15, 2018 Share Posted February 15, 2018 Are you sure that you've read pixi cache thingy? Please look closer, it does not use DOM id's at all. Quote Link to comment Share on other sites More sharing options...
charlie_says Posted February 15, 2018 Author Share Posted February 15, 2018 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; 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.