StreamingMp3Source
Audio source that supplies PCM samples on demand.
Implements
Section titled “Implements”Properties
Section titled “Properties”Methods
Section titled “Methods”onRangeAvailable()
Section titled “onRangeAvailable()”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
Implementation of
Section titled “Implementation of”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.
Implementation of
Section titled “Implementation of”fromByteSource()
Section titled “fromByteSource()”static fromByteSource(byteSource: ByteStreamSource, options?: object): Promise<StreamingMp3Source>;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
byteSource | ByteStreamSource |
options? | { decoderFactory?: Mp3DecoderFactory; id?: string; } |
options.decoderFactory? | Mp3DecoderFactory |
options.id? | string |
Returns
Section titled “Returns”Promise<StreamingMp3Source>
fromReader()
Section titled “fromReader()”static fromReader( reader: ReadableStreamDefaultReader<Uint8Array<ArrayBufferLike>>, initialChunks?: Uint8Array<ArrayBufferLike>[], totalBytes?: number,options?: object): Promise<StreamingMp3Source>;Parameters
Section titled “Parameters”| Parameter | Type | Default value |
|---|---|---|
reader | ReadableStreamDefaultReader<Uint8Array<ArrayBufferLike>> | undefined |
initialChunks | Uint8Array<ArrayBufferLike>[] | [] |
totalBytes? | number | undefined |
options? | { decoderFactory?: Mp3DecoderFactory; id?: string; } | undefined |
options.decoderFactory? | Mp3DecoderFactory | undefined |
options.id? | string | undefined |
Returns
Section titled “Returns”Promise<StreamingMp3Source>
isSupported()
Section titled “isSupported()”static isSupported(): Promise<boolean>;Returns
Section titled “Returns”Promise<boolean>