AudioSource
Audio source that supplies PCM samples on demand.
Properties
Section titled “Properties”Methods
Section titled “Methods”onRangeAvailable()?
Section titled “onRangeAvailable()?”optional onRangeAvailable(handler: (range: AudioRange) => void): () => void;Subscribes to progressive loading updates as new byte ranges arrive.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
handler | (range: AudioRange) => void | Callback receiving the newly available time range in seconds. |
Returns
Section titled “Returns”Unsubscribe function.
() => void
read()
Section titled “read()”read(options: object): | Float32Array<ArrayBufferLike>| Promise<Float32Array<ArrayBufferLike>>;Reads PCM samples for a specific channel and time range.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options | { channel: number; endTime: number; startTime: number; } | Channel index and time span in seconds. |
options.channel | number | - |
options.endTime | number | - |
options.startTime | number | - |
Returns
Section titled “Returns”| Float32Array<ArrayBufferLike>
| Promise<Float32Array<ArrayBufferLike>>
Float32Array of normalized audio samples.