Skip to content

AudioBlock

Defined in: src/types/media.ts:162

Audio content block.

new AudioBlock(data): AudioBlock;

Defined in: src/types/media.ts:172

ParameterType
dataAudioBlockData

AudioBlock

readonly type: "audioBlock";

Defined in: src/types/media.ts:164

Discriminator for audio content.


readonly format: AudioFormat;

Defined in: src/types/media.ts:167

Audio format.

AudioBlockData.format


readonly source: AudioSource;

Defined in: src/types/media.ts:170

Audio source.

AudioBlockData.source

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.

{
audio: {
format: AudioFormat;
source: | {
bytes: string;
}
| {
location: {
type: "s3";
uri: string;
bucketOwner?: string;
};
};
};
}

Wrapped audio block data

NameTypeDescriptionDefined in
audio{ format: AudioFormat; source: | { bytes: string; } | { location: { type: "s3"; uri: string; bucketOwner?: string; }; }; }-src/types/media.ts:200
audio.formatAudioFormatAudio format.src/types/media.ts:153
audio.source| { bytes: string; } | { location: { type: "s3"; uri: string; bucketOwner?: string; }; }Audio source.src/types/media.ts:156
JSONSerializable.toJSON

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.

ParameterTypeDescription
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.formatAudioFormatAudio format.
data.audio.source| { bytes: string | Uint8Array<ArrayBufferLike>; } | { location: { type: "s3"; uri: string; bucketOwner?: string; }; }Audio source.

AudioBlock

AudioBlock instance