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

Bug: v8.1.0:Strange bug, video cannot be controlled #10527

Open
li-yongyu opened this issue May 10, 2024 · 0 comments
Open

Bug: v8.1.0:Strange bug, video cannot be controlled #10527

li-yongyu opened this issue May 10, 2024 · 0 comments
Assignees
Labels
🔍 Needs Investigation Issue needs to be research or investigated further.

Comments

@li-yongyu
Copy link

li-yongyu commented May 10, 2024

Current Behavior

const video = await Assets.load({
      src: this.payload.url,
      data: {
          autoPlay: true, // 自动播放
          // preload: true,  // 预加载
          autoLoad: true, // 视频立即加载
          loop: true, // 是否循环
          muted: false,    // 是否静音
          // playsinline: true,   // 视频内嵌播放
      },
  });
const sprite = new Sprite(video);
sprite.width = this.info.width;
sprite.height = this.info.height;
app.stage.addChild(sprite);

Expected Behavior

The video plays automatically and in a loop with sound

Steps to Reproduce

Videos preloaded in advance through Assets.load cannot be control

await Assets.load({
                src: this.payload.url,
                data: {
                    autoPlay: true, // automatically play
                    preload: true, // preload
                    autoLoad: true, // Video loads immediately
                    loop: true, // Whether to loop
                    muted: false, // Whether to mute
                    // crossorigin: true,
                    // playsinline: true // Play as inline video, default value: true
                },
                loadParser: "loadVideo"
            });

If there is a set of urls in advance, loaded through Assets.load(urls), and then loaded through await Assets.load({...}), the video control will be found to be uncontrollable, unable to start looping and carry sound playback

Environment

  • pixi.js version: v8.1.0
  • Browser & Version: Chrome 124
  • OS & Version: windows11

Possible Solution

Do not load the video in advance through Assets.load. Control the loading through await Assets.load() every time it is used.

Additional Information

The following is the demo written in pixi’s official demo site

import { Application, Assets, Graphics, Sprite } from 'pixi.js';

(async () =>
{
    // Create a new application
    const app = new Application();

    // Initialize the application
    await app.init({ resizeTo: window });

    // Append the application canvas to the document body
    document.body.appendChild(app.canvas);

    const urls = [
        'https://pixijs.com/assets/bunny.png',
        'https://pixijs.com/assets/video.mp4'
    ];
    Assets.load(urls);
    setTimeout(()=>{
        (async()=>{
            const texture =  await Assets.load({
                src: "https://pixijs.com/assets/video.mp4",
                data: {
                    resourceOptions: {
                        autoPlay: true, // 自动播放
                        preload: true,  // 预加载
                        autoLoad: true, // 视频立即加载
                        loop: true, // 是否循环
                        muted: false,    // 是否静音
                    },
                },
            });
            const videoSprite = new Sprite(texture);
            // Stretch to fill the whole screen
            videoSprite.width = app.screen.width;
            videoSprite.height = app.screen.height;
            app.stage.addChild(videoSprite);
        })();
    },5000);
})();
@li-yongyu li-yongyu changed the title Bug: v8.1:Strange bug, video cannot be controlled Bug: v8.1.0:Strange bug, video cannot be controlled May 10, 2024
@Zyie Zyie added the 🔍 Needs Investigation Issue needs to be research or investigated further. label May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔍 Needs Investigation Issue needs to be research or investigated further.
Projects
None yet
Development

No branches or pull requests

4 participants