Jump to content

Issue with Video Texture & Loader


Gius80
 Share

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

 

 

Link to comment
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...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...