daily pastebin goal
1%
SHARE
TWEET

Untitled

a guest Aug 17th, 2018 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. HTML5 setting audio source in javascript not working
  2. <audio id="audioPlayer" width="400" height="30" controls="controls">        
  3.     <source id="oggSource" type="audio/ogg" />
  4.     <source id="mp3Source" type="audio/mp3" />
  5. </audio>
  6.    
  7. $('#oggSource').attr('src', 'OggFormat.ogg');
  8. $('#mp3Source').attr('src','Mp3Format.mp3');
  9.    
  10. <audio id="audioPlayer" width="400" height="30" controls="controls">        
  11.     <source id="oggSource" type="audio/ogg" src="OggFormat.ogg" />
  12.     <source id="mp3Source" type="audio/mp3" src="Mp3Format.mp3"/>
  13. </audio>
  14.    
  15. $("#oggSource").attr("src", "foo.ogg").detach().appendTo("#audioPlayer");
  16.    
  17. function updateSource(source, src) {
  18.     source = $(source);
  19.     source.attr("src", src).appendTo(source.parent());
  20. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top