Vizions Posted August 5, 2019 Share Posted August 5, 2019 Hello all, Does anybody know if it is possible to detect when a video that is loaded has completed? Or even some basic detection and control (onComplete, onStart, play, stop). I am trying to create a media slideshow that supports images and mp4's. I have built a similar slideshow in the past with Timeline Max but it appears that there is no support for videos in the JS version. This is what I have so far (Just a quick prototype to build on). let renderer; let stage = new PIXI.Container(); let button; const loader = PIXI.loader; renderer = new PIXI.CanvasRenderer(1024, 768); document.body.appendChild(renderer.view); load(); function load() { loader.add('box', 'assets/yellowBox.png') .add('movie', 'assets/testVideo.mp4') .load((loader, resource) => { onAssetsLoaded(resource); }) } function onAssetsLoaded(resource) { console.log('loaded'); // Video stuff let videoData = resource['movie'].data; let videoBaseTexture = PIXI.VideoBaseTexture.fromVideo(videoData); let videoSprite = PIXI.Sprite.from(videoBaseTexture); stage.addChild(videoSprite); } Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted August 5, 2019 Share Posted August 5, 2019 In this case, pixi just uses <video> element inside VideoBaseTexture. Same as HTML5 video. There are no extra features. Vizions 1 Quote Link to comment Share on other sites More sharing options...
Vizions Posted August 5, 2019 Author Share Posted August 5, 2019 Thanks @ivan.popelyshev. Do you know of any libraries that might make this possible? Quote Link to comment Share on other sites More sharing options...
jonforum Posted August 5, 2019 Share Posted August 5, 2019 on my side ,if you load a video in loader , you have in ressource a getter named ` res.isVideo ` you can use onclomplete from loader loader.onComplete.add((loader, res) => { res.myvideoname; //your video data }); or use somewhere after in your scene if is a game !. const videoSprite = new PIXI.Sprite( PIXI.Texture.fromVideo( $yourLoader.yourDataCache.yourvideoObj.data ) ); const videoControler = videoSprite.texture.baseTexture.source; 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.