cacophony
    Preparing search index...

    Class MediaStreamPlayback

    Hierarchy

    • BasePlayback
      • MediaStreamPlayback
    Index
    _effectChain?: EffectChain
    _filters: BiquadFilterNode[] = []
    _isFading: boolean
    _panType: PanType = "stereo"
    _sendGains: Map<Bus, GainNode> = ...

    Per-playback send-gain allocations owned by the shared routing state machine. Cleanup disconnects every allocation deterministically.

    _state: PlaybackState = "unplayed"
    eventEmitter: TypedEventEmitter<PlaybackEvents> = ...
    gainNode?: GainNode
    • get isFading(): boolean

      Returns boolean

    • get isPlaying(): boolean

      Checks if the audio is currently playing.

      Returns boolean

    • get position(): Position

      Gets the position of the audio source in 3D space (HRTF panning only).

      Returns Position

      The [x, y, z] coordinates of the audio source.

      Throws an error if the sound has been cleaned up or if HRTF panning is not used.

    • set position(position: Position): void

      Sets the position of the audio source in 3D space (HRTF panning only).

      Parameters

      • position: Position

        The [x, y, z] coordinates of the audio source.

      Returns void

      Throws an error if the sound has been cleaned up or if HRTF panning is not used.

    • get stereoPan(): number | null

      Gets the stereo panning value.

      Returns number | null

      The current stereo pan value, or null if stereo panning is not applicable.

    • set stereoPan(value: number): void

      Sets the stereo panning value.

      Parameters

      • value: number

        The stereo pan value to set, between -1 (left) and 1 (right).

      Returns void

      Throws an error if stereo panning is not available, if the sound has been cleaned up, or if the value is out of bounds.

    • get threeDOptions(): ThreeDOptions

      Gets the 3D audio options if HRTF panning is used.

      Returns ThreeDOptions

      The current 3D audio options (HRTF variant).

      Throws an error if the sound has been cleaned up or if HRTF panning is not used.

    • set threeDOptions(options: ThreeDOptions | Partial<HrtfPannerOptions>): void

      Sets the 3D audio options for HRTF panning. Accepts either a full ThreeDOptions value or a partial HRTF override. Any field omitted from the input is left at its current value on the underlying PannerNode.

      Parameters

      Returns void

      Throws an error if the sound has been cleaned up or if HRTF panning is not used.

    • get volume(): number

      Returns number

    • set volume(value: number): void

      Parameters

      • value: number

      Returns void

    • Cancels any in-progress fade, emitting fadeCancel if a fade was active.

      Returns void

    • Type Parameters

      • K extends "seek" | (keyof BaseAudioEvents)

      Parameters

      Returns void

    • Type Parameters

      • K extends "seek" | (keyof BaseAudioEvents)

      Parameters

      Returns Promise<void>

    • Parameters

      • isResume: boolean

      Returns void

    • Parameters

      • duration: number
      • Optionaltype: FadeType
      • Optionaloptions: { startTime?: number }

      Returns Promise<void>

    • Parameters

      • duration: number
      • Optionaltype: FadeType

      Returns Promise<void>

    • Fades the volume to a target value, emitting fadeStart and fadeEnd events.

      Parameters

      • value: number
      • duration: number
      • type: FadeType = "linear"
      • Optionaloptions: { startTime?: number; startValue?: number }

      Returns Promise<void>

    • Remove event listener.

      Type Parameters

      • K extends "seek" | (keyof BaseAudioEvents)

      Parameters

      Returns void

    • Register event listener.

      Type Parameters

      • K extends "seek" | (keyof BaseAudioEvents)

      Parameters

      Returns () => void

      Cleanup function

    • Parameters

      • handle: AudioNode
      • paramName: string
      • value: number
      • Optionaloptions: { duration?: number; type?: FadeType }

      Returns void

    • Parameters

      Returns void