AudioBlock
Defined in: src/types/media.ts:162
Audio content block.
Implements
Section titled “Implements”AudioBlockDataJSONSerializable<{audio:Serialized<AudioBlockData>; }>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new AudioBlock(data): AudioBlock;Defined in: src/types/media.ts:172
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
data | AudioBlockData |
Returns
Section titled “Returns”AudioBlock
Properties
Section titled “Properties”readonly type: "audioBlock";Defined in: src/types/media.ts:164
Discriminator for audio content.
format
Section titled “format”readonly format: AudioFormat;Defined in: src/types/media.ts:167
Audio format.
Implementation of
Section titled “Implementation of”source
Section titled “source”readonly source: AudioSource;Defined in: src/types/media.ts:170
Audio source.
Implementation of
Section titled “Implementation of”Methods
Section titled “Methods”toJSON()
Section titled “toJSON()”toJSON(): { audio: { format: AudioFormat; source: | { bytes: string; } | { location: { type: "s3"; uri: string; bucketOwner?: string; }; }; };};Defined in: src/types/media.ts:200
Serializes the AudioBlock to a JSON-compatible ContentBlockData object. Called automatically by JSON.stringify(). Uint8Array bytes are encoded as a base64 string.
Returns
Section titled “Returns”{ audio: { format: AudioFormat; source: | { bytes: string; } | { location: { type: "s3"; uri: string; bucketOwner?: string; }; }; };}Wrapped audio block data
| Name | Type | Description | Defined in |
|---|---|---|---|
audio | { format: AudioFormat; source: | { bytes: string; } | { location: { type: "s3"; uri: string; bucketOwner?: string; }; }; } | - | src/types/media.ts:200 |
audio.format | AudioFormat | Audio format. | src/types/media.ts:153 |
audio.source | | { bytes: string; } | { location: { type: "s3"; uri: string; bucketOwner?: string; }; } | Audio source. | src/types/media.ts:156 |
Implementation of
Section titled “Implementation of”JSONSerializable.toJSONfromJSON()
Section titled “fromJSON()”static fromJSON(data): AudioBlock;Defined in: src/types/media.ts:221
Creates an AudioBlock instance from its wrapped data format. Base64-encoded bytes are decoded back to Uint8Array.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
data | { audio: { format: AudioFormat; source: | { bytes: string | Uint8Array<ArrayBufferLike>; } | { location: { type: "s3"; uri: string; bucketOwner?: string; }; }; }; } | Wrapped AudioBlockData to deserialize |
data.audio | { format: AudioFormat; source: | { bytes: string | Uint8Array<ArrayBufferLike>; } | { location: { type: "s3"; uri: string; bucketOwner?: string; }; }; } | - |
data.audio.format | AudioFormat | Audio format. |
data.audio.source | | { bytes: string | Uint8Array<ArrayBufferLike>; } | { location: { type: "s3"; uri: string; bucketOwner?: string; }; } | Audio source. |
Returns
Section titled “Returns”AudioBlock
AudioBlock instance