Reputation: 5496
I want to play a small beep in my web application and then launch an alert message.
I therefore do:
if(_none_valid) {
$.playSound('/static/wav/beep_error.wav').delay(300);
alert('ERROR: Not found.');
}
What happens is that the .wav file is played AFTER the user has dismissed the alert.
I have tried to add delay(300)
as shown.
Why is this happening? How should be fixed?
I am using this library.
Upvotes: 1
Views: 68
Reputation: 12937
It is because you are adding a delay of 300
ms for $.playSound
. You need to add a delay or setTimeout()
for alert()
:
if(_none_valid) {
$.playSound('/static/wav/beep_error.wav');
setTimeout(function() {
alert('ERROR: Not found.');
}, 300);
}
Upvotes: 2