I am trying to run an audio after another using javascript. I get the name of the audio file from a vector and I have created some string. It is my code but I can not work it.
var audio = new audio (); Function playall () {var folder_name = "synthex /"; Var file_names = ".sentence"; Var audio_file = ".wav"; {Var dir_file = folder_name + voicesClicks [i] for (I = 0; i & lt; 18; ++ i); Dir_file = dir_file + file_name; If (voicemail [i] == faucet) {continue; } // var value = voice clip [i]; Dir_file = dir_file + i; Dir_file = dir_file + audio_file; Console.log (dir_file); Audio src = dir_file; Audio.play (); }}
There is a big problem that comes with your code, Audio
s src varies in each run, so even if the audio. Src
is a vaild wav file, then you will play the code one last ...
function playl () {// Change accordingly. Var urls = ['http://upload.wikimedia.org/wikipedia/en/f/f9/Beatles_eleanor_rigby.ogg', 'http://upload.wikimedia.org/wikipedia/commons/5/5b/Ludwig_van_Beethoven_-_Symphonie_5_c -mol_-_ 1._AlexGlow_con_brio.og ']; Var idx = 0; Var aud = new audio (); Aud.src = urls [idx]; Aud.addEventListener ('Finished', function () {// Automatically to begin next. Idx ++; if (idx === url.label) idx = 0; aud.src = urls [idx]; Aud.play ();}); Aud.play (); } Document.addEventListener ("DOMContentLoaded", playAll); // You can change it on the button. Click the handler. Edit: You can change urls
...
No comments:
Post a Comment