LocalAudioFrameListener | sinch-rtc
Description: Documentation for sinch-rtc

# Interface LocalAudioFrameListener

Registration for an AudioWorklet processor to install on the outgoing (local microphone) audio path. Despite the name, this is not a callback-style listener: the browser gives no access to the WebRTC audio thread, so all observation and in-place modification of the captured PCM happens inside a worklet you provide. This object just tells the SDK which worklet module to load and how to instantiate it.

The integrator supplies a worklet module (via moduleUrl) that calls `registerProcessor({@link processorName}, ...)`. Inside that processor's `process()` callback the raw frames can be read, modified in place, or zeroed to substitute silence. The processed audio is what is sent to the remote peer.

A complete, runnable example is wired into the JavaScript reference app.

interface LocalAudioFrameListener {
moduleUrl: string;
onMessage?: (message: unknown) => void;
processorName: string;
processorOptions?: Record<string, unknown>;
}

##### Index

### Properties

moduleUrl
onMessage?
processorName
processorOptions?

## Properties

### moduleUrl

moduleUrl: string

URL of the `AudioWorklet` module to load. The module must call `registerProcessor({@link processorName}, ...)`. Resolved relative to the document base URL.

### `Optional`onMessage

onMessage?: (message: unknown) => void

Optional handler invoked with messages your worklet posts back on its `MessagePort` — an observation channel you define (e.g. audio levels). The session format (sample rate, channel count) is available inside the worklet via the `sampleRate` global and the input array shape.

#### Type declaration

- - (message: unknown): void

  - #### Parameters

    - message: unknown

      the data posted from the worklet via `port.postMessage(...)`.

    #### Returns void

### processorName

processorName: string

The name the processor was registered with inside moduleUrl via `registerProcessor`.

### `Optional`processorOptions

processorOptions?: Record<string, unknown>

Optional data forwarded to your processor's constructor as `options.processorOptions` (must be structured-cloneable). The shape is entirely defined by your own worklet — the SDK only passes it through.