Haon1919 Posted September 18, 2018 Share Posted September 18, 2018 Hello friends, so when I am trying to add a video to the background of a scene along with various other objects. For some reason if I use an image and add it to the container then allow the code to execute everything shows up correctly. But when I make the video sprite and attempt to add it to that same container I get the buttons on the screen showing up fine with a black background. I am insure what I am doing wrong. -thanks in advance for the help! Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted September 18, 2018 Share Posted September 18, 2018 addToCache doesnt work like that, look at the code: https://github.com/pixijs/pixi.js/blob/dev/src/core/textures/BaseTexture.js#L794 As for video, it depends on the format and codec. Are you sure this particular video can be put in <video> element? Quote Link to comment Share on other sites More sharing options...
Haon1919 Posted September 18, 2018 Author Share Posted September 18, 2018 @ivan.popelyshev So I eventually was able to get something to show up. I changed the videoTexture line to be what I had below and the very first frame is showing now. I am assuming there is some autoplay boolean or method of the texture object that I can use? var videoTexture = PIXI.Texture.fromVideo(PIXI.loader.resources['resources/videos/start_screen_test_8.mp4'].data); Quote Link to comment Share on other sites More sharing options...
jonforum Posted September 19, 2018 Share Posted September 19, 2018 6 hours ago, Haon1919 said: @ivan.popelyshev So I eventually was able to get something to show up. I changed the videoTexture line to be what I had below and the very first frame is showing now. I am assuming there is some autoplay boolean or method of the texture object that I can use? var videoTexture = PIXI.Texture.fromVideo(PIXI.loader.resources['resources/videos/start_screen_test_8.mp4'].data); hi , i remember get some issue with video loader and first frame freezing. By default the autoPlay is alway force to true. here a good way to create a video controler const texture = PIXI.Texture.fromVideo('data2/Video/intro/vidA1.webm'); const videoSprite = new PIXI.Sprite(texture); const videoControler = texture.baseTexture.source; videoSprite.width = 1920; videoSprite.height = 1080; videoControler.currentTime = 12.2; videoControler.onended = function(){ this.nextVideo(); }.bind(this); this.addChild(videoSprite); this.videoControler = videoControler; and to start video Scene_IntroVideo.prototype.start = function() { Scene_Base.prototype.start.call(this); this.videoControler.play(); }; if you have issue, try hack PIXI to force autoplay to the default source autoPlay https://github.com/pixijs/pixi.js/pull/5112/commits/e2a5836ecfbd86e2115f3a44212b63a45101a5f0 It work for me Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted September 19, 2018 Share Posted September 19, 2018 I think you should search this forum and pixijs issues on github first, because I'm sure I saw that problem several times. Then ask @xerver 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.