goldfire / howler.js

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

Tone is not stopping if I put a beep tone (duration less then 1 sec) #1673

Open VikasChauhan95 opened 1 year ago

VikasChauhan95 commented 1 year ago

The Problem

In my call application, I'm employing the Howler library to incorporate an alert tone. This tone is played when the user receives or dials a call. Here's the scenario:

When the user receives a call, a beep tone is continuously played in a loop until they accept or reject the call. Additionally, when the user accepts or rejects the call, the same beep tone is played once (not in a loop). However, before playing it, I ensure to stop the previously playing tone each time. Furthermore, I create a new Howler object every time a tone needs to play.

Reproducible Example

No response

Reproduction Steps

To implement the desired functionality, follow these steps:

Create a Howler object with a tone that has a duration of less than 1 second and set the loop property to true and html5 true.

Create another Howler object with the same tone, but this time set the loop property to false.

To play the tones as specified:

Start by playing the looped tone first. After a delay of 3-4 seconds, stop the looped tone. And at the same time play the non-looped tone.

Possible Solution

No response

Context

No response

Howler.js Version

2.2.3

Affected Browser(s)/Versiuon(s)

No response

VikasChauhan95 commented 11 months ago

Adding more Information: Attaching some logs in which you can see a howler object is created and the tone started playing and then another event came with a different tone URL and the old tone should be stopped because I have called stop() method but it didn't stop. Although we received the OnStop event for the last tone still it kept playing.

Into playMusic tone events for tone: , https://d318j5xewe9ubj.cloudfront.net/cc_6/resources/media/8dc4f022-2c94-464c-894e-47e7d4e44177.wav in loop: true for State OUTBOUND_RINGING [] PlayTone objected created tone events : loop: true ['https://d318j5xewe9ubj.cloudfront.net/cc_6/resources/media/8dc4f022-2c94-464c-894e-47e7d4e44177.wav'] onplay tone events: (2) ['https://d318j5xewe9ubj.cloudfront.net/cc_6/resources/media/8dc4f022-2c94-464c-894e-47e7d4e44177.wav', 1002] onplay tone events: (2) ['https://d318j5xewe9ubj.cloudfront.net/cc_6/resources/media/8dc4f022-2c94-464c-894e-47e7d4e44177.wav', 1002] onplay tone events: (2) ['https://d318j5xewe9ubj.cloudfront.net/cc_6/resources/media/8dc4f022-2c94-464c-894e-47e7d4e44177.wav', 1002] onplay tone events: (2) ['https://d318j5xewe9ubj.cloudfront.net/cc_6/resources/media/8dc4f022-2c94-464c-894e-47e7d4e44177.wav', 1002] alert tone url https://d318j5xewe9ubj.cloudfront.net/cc_6/resources/media/public/ade3ff68-37a7-4448-afd5-3cd806c41f73.wav Stopping Play tone events : (3) ['https://d318j5xewe9ubj.cloudfront.net/cc_6/resources/media/8dc4f022-2c94-464c-894e-47e7d4e44177.wav', ' state: ', 'OUTBOUND_CONNECTED'] Into playMusic tone events for tone: , https://d318j5xewe9ubj.cloudfront.net/cc_6/resources/media/public/ade3ff68-37a7-4448-afd5-3cd806c41f73.wav in loop: false for State OUTBOUND_CONNECTED [] PlayTone objected created tone events : loop: false ['https://d318j5xewe9ubj.cloudfront.net/cc_6/resourc…a/public/ade3ff68-37a7-4448-afd5-3cd806c41f73.wav'] onStopped tone events: (2) ['https://d318j5xewe9ubj.cloudfront.net/cc_6/resources/media/8dc4f022-2c94-464c-894e-47e7d4e44177.wav', 1002] onplay tone events: (2) ['https://d318j5xewe9ubj.cloudfront.net/cc_6/resourc…a/public/ade3ff68-37a7-4448-afd5-3cd806c41f73.wav', 1004] onplay tone events: (2) ['https://d318j5xewe9ubj.cloudfront.net/cc_6/resources/media/8dc4f022-2c94-464c-894e-47e7d4e44177.wav', 1002] onplay tone events: (2) ['https://d318j5xewe9ubj.cloudfront.net/cc_6/resources/media/8dc4f022-2c94-464c-894e-47e7d4e44177.wav', 1002]