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

Pause/Resume Bug in PixiJS Sound v4.4.1 Causes Unexpected Spritemap Behavior #269

Open
nizamiza opened this issue Aug 9, 2024 · 0 comments

Comments

@nizamiza
Copy link

nizamiza commented Aug 9, 2024

Description

PixiJS Sound v4.4.1 has a pause/resume issue when working with spritemaps. Pausing and resuming a sound causes unexpected behavior, such as jumping to the next sound in the spritemap instead of restarting the current sound.

I believe that this issue arises because the internal _elapsed time scales according to the entire spritemap, and the AudioBufferSourceNode API lacks native pause/resume functionality. The known workaround is to manually control the playbackRate property of the AudioBufferSourceNode.

Reproduction

I've created a repro repository here: https://github.com/nizamiza/pixi-sound-pause-resume-issue-repro

It has a detailed description of the issue, the use-case applied, and a an option to test the workaround as a well a fix for the elapsed time.

In the repro repository, the WebAudioNode instance is used to toggle paused state. I'm not 100% sure that this is an intended way. When you run the repro project, open it in your browser and follow the instructions to experience the problem.

Let me know if you need any additional info.

Packages info

  • pixi.js version: 6.4.2
  • @pixi/sound version: 4.4.1
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