AudioPlayer

The AudioPlayer widget plays audio from uploaded assets or the URL link.

Adding AudioPlayer to your project

Here's how you can add the AudioPlayer widget to your project:

  1. Drag the AudioPlayer widget from the Base Elements tab (in the Widget Panel) or add it directly from the widget tree.

  2. Move to the properties panel (on the right side of your screen) and scroll down to the Audio Options section.

  3. Find the Title property and enter the value to display the audio title. You can also set this from the variable, such as the app state variable, API response variable, Firestore document, and more. To do so, click on the Set from Variable.

  4. Find the Path property and enter the URL for the new audio file.

  5. By default, the audio stops when you move to another page using the Pause on Forward Navigation property.

  6. When an app goes in the background while the audio player is running, you can control the audio player's behavior using the Play in Background property, which has got the following options:

    1. Enabled: This keeps the audio player running.

    2. Disabled, restore on foreground: This pauses the audio player and starts playing again as soon as the app is visible.

    3. Disabled, pause: This stops the audio player as soon as the app goes in the background.

By default, every AudioPlayer widget added to the project will show sample audio from the internet.

Changing audio type

By default, the widget is set to play audio from the internet. However, you can change this to use the audio uploaded directly to your app.

Here's how you can change the audio type:

  1. Select the AudioPlayer widget from the widget tree or the canvas area.

  2. Move to the properties panel (on the right side of your screen) and scroll down to the Audio Options section.

  3. Find the Audio Type dropdown and select Asset.

  4. Now, find the Asset Audio property, click the Upload Audio button, select the audio and upload it.

Once you upload the audio, you can use it throughout your app. You can manage your uploaded audios with the Project Media Asset Manager.

To use the uploaded audio:

  1. Select the AudioPlayer widget from the widget tree or the canvas area.

  2. Move to the properties panel (on the right side of your screen) and scroll down to the Audio Options section.

  3. Find the Audio Type dropdown and select Asset.

  4. Click on No asset select (inside the dropdown) and choose the audio.

Playing audio from Firestore Data

To play an audio file from the Firestore data, ensure you:

  1. Completed all steps in the Firebase Setup section for your project.

  2. Retrieved Data from either collection or document.

  3. Finally, to set the audio URL from the Firestore document, follow the steps here.

Customization

You can customize the appearance of this widget using the various properties available under the properties panel.

Changing colors

To change the audio tile colors:

  1. Select the AudioPlayer widget from the widget tree or the canvas area.

  2. Move to the properties panel (on the right side of your screen) and scroll down to the Audio Player Properties section.

  3. To change the background color of the tile, Find the Fill Color property click on the box next to the already selected color, select the color, and then click Use Color or click on an already selected color and enter a Hex Code directly. You can also choose the color by clicking the Palette and Simple button.

  4. Similarly, you can change the Playback Button Color (play and pause button) and Active Track Color (the bar color that shows the progress of the currently playing audio).

Set color dynamically

See how to set a color from variable to any color property of this widget.

Changing elevation

To change the elevation (depth or Z-axis) of the audio tile:

  1. Select the AudioPlayer widget from the widget tree or the canvas area.

  2. Move to the properties panel (on the right side of your screen) and scroll down to the Audio Player Properties section.

  3. Find the Elevation input box and enter the value to see the drop shadow effect below the badge. The Higher value sets the bigger size of the shadow, whereas the 0 value removes the shadow.

Styling title text

To change the title text style:

  1. Select the AudioPlayer widget from the widget tree or the canvas area.

  2. Move to the properties panel (on the right side of your screen) and scroll down to the Title Text Style section.

  3. Find the Theme Text Style property and change the style as per instructions here.

Styling playback duration text

To change the playback duration text style:

  1. Select the AudioPlayer widget from the widget tree or the canvas area.

  2. Move to the properties panel (on the right side of your screen) and scroll down to the Playback Duration Text Style section.

  3. Find the Theme Text Style property and change the style as per instructions here.

Show/Hide widget

Please find the instructions to show/hide the widget here.

Last updated