Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The transparent background of video is glitching #521

Open
ricomuh opened this issue Apr 22, 2024 · 0 comments
Open

The transparent background of video is glitching #521

ricomuh opened this issue Apr 22, 2024 · 0 comments

Comments

@ricomuh
Copy link

ricomuh commented Apr 22, 2024

WhatsApp Image 2024-04-23 at 04 35 29_1a901809

I use webm video that has alpha channel, when the video is playing, the background is glitching like the screenshot above.

here is my full code:
`

<style>
  body {
    margin: 0;
    overflow: hidden;
  }
  a-scene {
    height: 100vh;
  }
</style>

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/mindar-image.prod.js"></script>
<script src="https://aframe.io/releases/1.2.0/aframe.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/mindar-image-aframe.prod.js"></script>
<script src="https://unpkg.com/[email protected]/dist/aframe-transparent-video-shader.umd.js"></script>
  <a-assets>
    <video id="videoPreview" preload autoplay loop>
      <!-- <source src="./assets/Preview.mp4" type="video/mp4" /> -->
      <source src="./assets/Tes2.webm" type="video/webm" />
    </video>
  </a-assets>

  <a-entity
    mindar-image-target="targetIndex: 0"
    position="0 0 -5"
    transparent="true"
    id="videoPlane"
  >
    <a-video
      src="#videoPreview"
      width="1"
      height="1.8"
      rotation="0 0 0"
      scale="1 1 1"
      transparent="true"
    ></a-video>
  </a-entity>
</a-scene>

<script>
  const scene = document.querySelector("a-scene");
  const video = document.querySelector("#videoPreview");
  const target = document.querySelector("#videoPlane");

  target.addEventListener("targetFound", () => {
    video.play();
  });

  target.addEventListener("targetLost", () => {
    video.pause();
  });
</script>
`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant