THEOplayer > WebAudio
The Web Audio API.Signature:
export interface WebAudio
Create an AudioNode in the given AudioContext.
The Web Audio API allows you to reroute the audio output of THEOplayer to a Web Audio context. This is done by providing a Web Audio source node which outputs the player's audio. Using Web Audio allows developers to apply a variety of effects and transformations to the player's audio output, e.g. equalization, volume normalization, ...
The way the Web Audio standard was designed has a few consequences.
Once the player has created an AudioNode within a given AudioContext, you must connect it to an output node in the graph, directly or indirectly, or the output will be silent. The flow of audio from the created node has to reach an output node, one way or another. Of course, the player's output can pass through an arbitrary number of intermediary nodes before it reaches an output node.
Once the player's is rerouted, there is no way back: the audio cannot be released from its AudioContext, as Web Audio specifies no way to release audio resources which are piped through. This means that you cannot change the AudioContext of the output node, nor can you stop piping the player audio to Web Audio. In a well-designed Web Audio setup, this should not matter, as there should be exactly one AudioContext per page, and there should be no need to stop piping to Web Audio.
For advertisements, due to technical limitations, not all the audio can be rerouted using Web Audio. Notably, Google IMA ads do not allow their audio to be rerouted, and therefore will not pass through the Web Audio graph as specified by the developer.
Available since v2.19.4.