How to use the howler.iOSAutoEnable function in howler

To help you get started, we’ve selected a few howler examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github avgjs / avg-core / src / classes / SoundManager.js View on Github external
*/

/* eslint-disable */
import core from 'core/core';

const Howler = require('howler');

const logger = core.getLogger('SoundManager');

/* By default, audio on iOS is locked until a sound is played within a user interaction,
* and then it plays normally the rest of the page session (Apple documentation).
* The default behavior of howler.js is to attempt to silently unlock audio playback by
* playing an empty buffer on the first touchend event.
* This behavior can be disabled by calling:
*/
Howler.iOSAutoEnable = false;

let Channels = [],
    Resolve = [];

export function getChannel(index) {
  return new Promise((resolve, reject) => {
    const ch = Channels[index];

    if (ch) { resolve(ch); } else {
      logger.error(`Channel ${ch} hasn't been initialed. Call .load() first.`);
      reject();
    }
  });
}

export function setChannel(index, options) {