AudioAsset.getDuration

Gets the duration of the audio in seconds

AudioAsset.getDuration() method

Gets the duration of the audio in seconds

Signature:

getDuration(): Promise<number | null>;

Returns:

Promise<number | null>

A promise that resolves to the duration, or null if it cannot be determined

Example

const seconds = await audioAsset.getDuration();
Last updated: November 9, 2026 at 9:37 AMEdit this page