M
M
Maxim Timofeev2017-04-23 01:41:20
JavaScript
Maxim Timofeev, 2017-04-23 01:41:20

How to make the function start at the end of the sound (play)?

Goodnight. It's time for bed, but I won't sleep until I finish it. There is a code:

var voice = $('#voice');
voice[0].play(); //запуск аудио
getWordData(); //некая функция

Can't figure out how to execute the function until after the audio ends.
tried
voice[0].play(); //запуск аудио
voice.on('ended',function () {
getWordData(); //некая функция
});

But there, in the function, there is a launch of another audio, moreover, by replacing the src of the same voice, so it essentially enters an endless loop.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergiu Mitu, 2017-04-23
@EaGames

you are doing everything right.

But there, in the function, there is a launch of another audio, and through the replacement of src for the same voice
so in the same function you run before the function that starts another audio... getWordData(); //некая функция

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question