goldfire / howler.js

Javascript audio library for the modern web.
https://howlerjs.com
MIT License
23.29k stars 2.21k forks source link

Why callback not be cleared automaticlly after sound stopped #1695

Open AG2023 opened 7 months ago

AG2023 commented 7 months ago

The Problem

I find that when user add an 'end' event and callback to a sound (with "once" method) and play it, if user stop the sound before it play to complete, the callback will not be cleared automatically. you can repeat the operation several time, once the sound play to complete, the callback will fired many times.

Reproducible Example

howl.once('end', callback);

Reproduction Steps

I add an 'end' event and callback to a sound (with 'once' method as: howl.once('end', callback)) and play it, then stop it before it complete. Repeat the above operation 5 times. but in the last time, do not stop the sound, let it play to complete. Issue: when the sound (the last play) play to complete, the callback are fired 5 time in same time. In my mind, when use stop a sound, the callback should be cleared automatically, because the callback is no longer useful。

Possible Solution

No response

Context

No response

Howler.js Version

v2.1.3

Affected Browser(s)/Versiuon(s)

Chrome 119.0.6045.124