0

I am trying to expose the AudioContext api in the global Howler and assign it to a variable, however I am unable to figure out how to get Howler.ctx to not be null.

const CTX = Howler.ctx ; // Howler.ctx is returning null
Rex
  • 376
  • 2
  • 11

1 Answers1

5

The AudioContext doesn't get setup in howler.js until a Howl is created. However, you can trick it into creating one by calling one of the following, which will in turn call the internal setupAudioContext method:

Howler.mute(false);
Howler.volume(1);
James Simpson
  • 13,488
  • 26
  • 83
  • 108