Sign in to follow this  
Gius80

Issue with Video Texture & Loader

Recommended Posts

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

 

 

Share this post


Link to post
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...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.