Interface MediaStreamSoundOptions

interface MediaStreamSoundOptions {
    panType?: PanType;
    primeWithMediaElement?: boolean;
    stopTracksOnStop?: boolean;
}

Properties

panType?: PanType
primeWithMediaElement?: boolean

Attach the stream to a muted HTMLAudioElement while it plays.

Chromium will not render a remote WebRTC MediaStreamTrack that is only connected to the Web Audio graph: packets arrive but the decoder produces zero samples, so a MediaStreamAudioSourceNode taps pure silence. Pulling the same stream through a media element "primes" the decode pipeline; the Web Audio path then receives real audio. The element is muted so it does not double-play over the (possibly spatialised) Web Audio output. Firefox does not need this, but the priming element is harmless there.

Defaults to true. Set to false for streams that are never routed to a Web Audio graph, or in environments without HTMLAudioElement.

stopTracksOnStop?: boolean