Audio Player

The Avonni Audio Player provides robust audio playback with extensive customization options for sources, playback controls, volume, and visual styling.

Overview

The Avonni Audio Player component allows you to add audio playback functionality to your Flow screens. Users can listen to audio files with full playback controls, making it ideal for training materials, voice messages, audio instructions, or any scenario where audio content enhances the user experience.


Configuration

Select the Audio Player component on the Flow canvas to access its properties.

Audio Source

Source (Required)

Specifies which audio file to play. You have three options:

Option 1: URL to an Audio File

  • Provide the complete URL to an audio file hosted online

  • Must include the full path with https://

  • Supported formats: MP3, WAV, OGG, AAC

  • Example: https://www.example.com/audio/training-intro.mp3

Option 2: Upload Audio File

  • Click the upload button to select an audio file from your computer

  • The file will be stored with your Flow

  • Best for smaller audio files (under 5MB recommended)

  • Supported formats: MP3, WAV, OGG

Option 3: Variables & Flow Resources

Map the Source property to a Flow variable or resource that contains an audio file URL.

How to set this up

  1. On the Source property field, click on the mapped icon, located on the right.

  2. Choose from available resources when mapped option is selected. It can be either:

    • Text Variables: Variables you've created that store audio URLs

    • Record Fields: Fields from Get Records elements that contain URLs

    • Formula Resources: Formulas that construct or return audio URLs

    • Screen Component values: Output from previous screen inputs

    • ContentDocumentId: The Salesforce File ID of an audio file stored in Salesforce Files

    💡 Key Insight: The Audio Player accepts both external URLs (e.g., https://example.com/audio.mp3) AND Salesforce ContentDocumentIds (e.g., 069xx000005678ABC). This means you can play audio files stored directly in Salesforce Files.

Autoplay

Controls whether the audio starts playing automatically when the screen loads.

  • Checked (On): Audio begins playing immediately when the user reaches this Flow screen

  • Unchecked (Off - Default): User must click the play button to start audio

Loop

Controls whether the audio automatically restarts from the beginning when it finishes playing.

  • Checked (On): Audio repeats continuously until manually stopped

  • Unchecked (Off - Default): Audio plays once and stops

Hide Controls

Determines whether the playback control interface is visible to users.

  • Checked (On): Controls are hidden - users cannot pause, seek, or adjust volume

  • Unchecked (Off - Default): Full playback controls are visible (play/pause, progress bar, volume)

Volume

Sets the default volume level when the audio player loads.

  • Range: 0 to 100

    • 0 = Muted (no sound)

    • 50 = Half volume

    • 100 = Maximum volume (default)

Playback Rate

Adjusts the speed at which the audio plays.

Available options:

  • 0.5 - Half speed (slower, easier to follow)

  • 1 - Normal speed (default)

  • 2 - Double speed (faster playback)


Configuration Examples

Example 1: Simple Audio Instruction

Scenario: Play a voice instruction that users must hear before proceeding.

Configuration:

  • Source: Upload your instruction MP3 file

  • Autoplay: Checked (starts automatically)

  • Loop: Unchecked (plays once)

  • Hide Controls: Unchecked (users can replay if needed)

  • Volume: 80

  • Playback Rate: 1


Example 2: Background Ambient Audio

Scenario: Continuous background music during a waiting or processing screen.

Configuration:

  • Source: URL to ambient music file

  • Autoplay: Checked (starts automatically)

  • Loop: Checked (repeats continuously)

  • Hide Controls: Checked (no user interaction needed)

  • Volume: 40 (subtle background level)

  • Playback Rate: 1


Example 3: Play Audio File from Salesforce Files

Scenario: Play a voice message or recording that's stored as a Salesforce File and related to the current Account record.

Why This Approach Requires Two Get Records

Salesforce stores files using three separate objects that work together:

  1. ContentDocument - The actual file

  2. ContentVersion - Versions of the file (contains file details like title, extension, and the ContentDocumentId)

  3. ContentDocumentLink - The relationship linking files to records (Accounts, Cases, etc.)

The Challenge: We need to find audio files related to a specific record (Account), but:

  • ContentDocumentLink knows which files are related to the record but doesn't have file details (like file extension or title)

  • ContentVersion has file details and the ContentDocumentId we need for the Audio Player, but doesn't directly link to records

The Solution: Bridge the gap with two queries:

  1. First Get Records finds all files linked to the Account

  2. Second Get Records uses those ContentDocumentIds to find the specific audio file with the details we need

Think of it like a two-step lookup: "What files are attached to this Account?" → "Which of those files is the audio file I want?"

Flow Setup

1
  • Element: Get Records

  • Object: ContentDocumentLink

  • Filter Conditions:

    • LinkedEntityId Equals {!recordId} (current Account ID)

  • How Many Records: All records

  • Store in: RelatedFiles

What this does: Retrieves all file relationships for this Account. The result contains ContentDocumentIds of all attached files, but no file details.

2

Get Audio File Details

  • Element: Get Records

  • Object: ContentVersion

  • Filter Conditions:

    • ContentDocumentId In {!RelatedFiles.ContentDocumentId} ← Uses IDs from Step 1

    • FileExtension Equals mp3 (or wav, ogg) ← Filters for audio files only

    • Title Contains voice-message (optional - to find specific files)

    • IsLatest Equals True ← Gets the current version, not old versions

  • Sort By: CreatedDate Descending ← Gets the most recent if multiple match

  • How Many Records: Only the first record

  • Store in: AudioFile

    • What this is: A Record Variable that you'll create to store the ContentVersion record

    • How to create it: When configuring the Get Records element, in the "Store the first record in" field, click "New Resource" to create a new variable:

      • Resource Type: Variable

      • API Name: AudioFile

      • Data Type: Record

      • Object Type: ContentVersion

      • Allow multiple values: Unchecked (we're storing only one record)

What this does: Takes the ContentDocumentIds from Step 1 and queries ContentVersion to find which one is an audio file, then stores that record in the AudioFile variable so we can reference it later.

3
  • Element: Decision

  • Outcome 1: "Audio File Found"

    • Condition: {!AudioFile} Is Null False ← Checks if our variable has a value

  • Default Outcome: "No Audio File"

What this does: Prevents errors if no audio file is attached to the Account.

4

Audio Player Screen (on "Audio File Found" path)

  • Component: Audio Player

  • Source: {!AudioFile.ContentDocumentId} ← References the ContentDocumentId field from our AudioFile variable

  • Autoplay: Unchecked (user controls playback)

  • Loop: Unchecked (plays once)

  • Hide Controls: Unchecked (full user control)

  • Volume: 80

  • Playback Rate: 1


Last updated

Was this helpful?