javascript - Changing src attribute of HTML5 audio element -



javascript - Changing src attribute of HTML5 audio element -

i trying utilize js playback sounds. want have piece of music playing after time replace sound file. thought effective way reuse same sound object, seems not kill original sound gets messy. best way this?

my code below, im doing passing in new source @ time

function ingamesndcreate(src) { ingamesnd = new audio(src) ingamesnd.loop = true; ingamesnd.play(); }

thanks in advance

i expect you'll need alter source in dom using javascript. next should work.

document.getelementbyid('audio_id').src = 'different_file.wav';

javascript audio html5

Comments

Popular posts from this blog

Using Android Volley to post an array to PHP -

python - How to add an model instance to a django queryset? -

angularjs - No 'Access-Control-Allow-Origin' error from local domain to public API -