mostly filebased Content Presentation System
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

init_audio.js 924B

1234567891011121314151617181920212223242526272829303132
  1. context = new (window.AudioContext || window.webkitAudioContext)();
  2. // shim layer with setTimeout fallback
  3. window.requestAnimFrame = (function(){
  4. return window.requestAnimationFrame ||
  5. window.webkitRequestAnimationFrame ||
  6. window.mozRequestAnimationFrame ||
  7. window.oRequestAnimationFrame ||
  8. window.msRequestAnimationFrame ||
  9. function( callback ){
  10. window.setTimeout(callback, 1000 / 60);
  11. };
  12. })();
  13. var sample = new AudioTagSample({orientation:'horizontal',axisScale:'lin'});
  14. var links = document.querySelectorAll('.audio');
  15. for (i=0;i<links.length;i++){
  16. links[i].addEventListener("click", function(ev) {
  17. ev.preventDefault();
  18. context.resume();
  19. sample.click(ev.target);
  20. });
  21. }
  22. function play_pause(el) {
  23. if (sample.audio.paused) {
  24. sample.click(sample.link);
  25. } else {
  26. sample.click(sample.link);
  27. }
  28. }