mml-io / mml

Metaverse Markup Language
https://mml.io
MIT License
124 stars 15 forks source link

[Bug]: possible race condition on `mml-web` -> `m-audio` #168

Open TheCodeTherapy opened 6 months ago

TheCodeTherapy commented 6 months ago

Describe the bug

Trying to play an m-audio tag that was already appended to the document and is enabled, paused and has volume="0" by setting new attributes to volume to more than 1, start-time to document.timeline.currentTime and pause-time to document.timeline.currentTime + 4000 should play the audio and pause it after 4 seconds.

Expected behavior

The expected behavior is for the audio to start playing immediately and then pause after 4 seconds. Instead, an error can be seen on console:

The play() request was interrupted by a call to pause()

The error comes from Audio.ts line 339.

How to reproduce the bug

An MML document example that can reproduce this bug can be found here

All the audio assets used by the example MML document to reproduce the issue can be found here.

The GLB assets used in the example can be found: 1) here 2) here 3) here 4) here

https://github.com/mml-io/mml/assets/33723163/3ba4fd12-bdbf-4750-b08a-e5cbcbceb550

Link to the code that reproduces this bug

https://github.com/TheCodeTherapy/3d-web-experience/blob/382e4e9e546b13fe0d36d3cd8d2a04a17b16460c/example/multi-user-3d-web-experience/server/mml-documents/example-piano.html

Packages

mml-web

Package versions

0.14.0

Extra details

No response