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.

WebAudioUtils.js 418B

1234567891011121314
  1. /**
  2. * Adapter that creates AudioContext objects depending on the browser.
  3. *
  4. * @returns {AudioContext} - Return a new AudioContext or undefined if the browser does not support it.
  5. */
  6. export function createAudioContext(options) {
  7. const AudioContextImpl = window.AudioContext || window.webkitAudioContext;
  8. if (!AudioContextImpl) {
  9. return undefined;
  10. }
  11. return new AudioContextImpl(options);
  12. }