Audio
Audio values to BAML functions can be created in client libraries. This document explains how to use these functions both at compile time and runtime to handle audio data. For more details, refer to audio types.
Usage Examples
Static Methods
Creates an Audio object from a URL. Optionally specify the media type, otherwise it will be inferred from the URL.
Creates an Audio object using Base64 encoded data along with the given MIME type.
Instance Methods
Check if the audio is stored as a URL.
Get the URL of the audio if it’s stored as a URL. Throws an Error if the audio is not stored as a URL.
Get the base64 data and media type if the audio is stored as base64. Returns [base64Data, mediaType]. Throws an Error if the audio is not stored as base64.
Convert the audio to a JSON representation. Returns either a URL object or a base64 object with media type.