Gius80 Posted June 2, 2019 Share Posted June 2, 2019 Hello guys, I'm trying to use PIXI for displaying a video loaded with PIXI Loader (instead of html video tag), but I get this DOM Exception (on t.play method) this._isSourcePlaying() ? this._onPlayStart() : this.autoPlay && t.play() Here is my code (DOESN'T WORK). I see the first frame, but the video doesn't start. app.loader.add("video", "video.mp4").load((loader, resources) => { const texture = PIXI.Texture.from(resources.video.data); const sprite = new PIXI.Sprite.from(texture); sprite.width = 800; sprite.height = 600; app.stage.addChild(sprite); }); If I add the texture based on an explicit action (mouse click) or instead of using loader i add a texture form a video html element, it works. This code WORKS. Video autoplays. app.loader.add("video", "video.mp4").load((loader, resources) => { document.getElementById("play").addEventListener("click", () => { const texture = PIXI.Texture.from(resources.video.data); const sprite = new PIXI.Sprite.from(texture); sprite.width = 800; sprite.height = 600; app.stage.addChild(sprite); }); }) This code also WORKS. Video autoplays. app.loader.add("video", "video.mp4").load((loader, resources) => { const texture = PIXI.Texture.from(document.getElementById("video")); const sprite = new PIXI.Sprite.from(texture); sprite.width = 800; sprite.height = 600; app.stage.addChild(sprite); }); Any idea? I'd like to use PIXI Loader because I need to handle different assets loading. PS The video doesn't have audio. Thanks, Igor Quote Link to comment Share on other sites More sharing options...
themoonrat Posted June 2, 2019 Share Posted June 2, 2019 If you set the video src tag to be explicitly muted, you should be able to autoplay it without a user interaction. Quote Link to comment Share on other sites More sharing options...
Gius80 Posted June 4, 2019 Author Share Posted June 4, 2019 Thanks, I'll try! 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.