API

Class AudioEngine

This represents the default audio engine used in babylon. It is responsible to play, synchronize and analyse sounds throughout the application.

Implements

Index
  • Instantiates a new audio engine.

    Parameters

    • hostElement: Nullable<HTMLElement> = null

      defines the host element where to display the mute icon if necessary

    • audioContext: Nullable<AudioContext> = null

      defines the audio context to be used by the audio engine

    • audioDestination: Nullable<AudioDestinationNode | MediaStreamAudioDestinationNode> = null

      defines the audio destination node to be used by audio engine

    Returns AudioEngine

canUseWebAudio: boolean = true

Gets whether the current host supports Web Audio and thus could create AudioContexts.

isMP3supported: boolean = false

Gets whether or not mp3 are supported by your browser.

isOGGsupported: boolean = false

Gets whether or not ogg are supported by your browser.

onAudioLockedObservable: Observable<IAudioEngine> = ...

Event raised when audio has been locked on the browser.

onAudioUnlockedObservable: Observable<IAudioEngine> = ...

Event raised when audio has been unlocked on the browser.

unlocked: boolean = false

Gets whether audio has been unlocked on the device. Some Browsers have strong restrictions about Audio and won't autoplay unless a user interaction has happened.

WarnedWebAudioUnsupported: boolean = false

Defines if Babylon should emit a warning if WebAudio is not supported.