Play audio

Plays an MP3 track in your app.

👉 The Tag

This set of tags allows to play an MP3 track in your app.
Play audio
Pause audio
Progress bar
Play audio in background
Loading indicator
Current played time
Total time
[action:play:URL] or [action:play]
Use [action:play] if you are getting the URL by API.
Plays the MP3 audio track. When this element is visible, the pause element will be invisible, and vice versa.
Replace URL with an actual URL ending in .mp3
📍 Where to add the tag: Any layer, except top-level and container.
[action:pause]
Pauses the MP3 audio track. This element will be invisible until user clicks the play element.
📍 Where to add the tag: Any layer, except top-level and container.
[audio:progress:#FFFFFF]
You can change the color by setting the HEX color in the tag.
Displays a progress bar to move forward or rewind the audio track. The appearance will be the native component for each device.
📍 Where to add the tag: A Rectangle layer.
[audio:background]
Optional tag. If this tag is included, audio files will continue playing when the app is open in the background. In order to stop the audio, users will have to return to the page where the audio was started and tap pause.
If this tag is not included, audio files will only play when its page is visible and will pause otherwise.
📍 Where to add the tag: Any layer, except top-level and container.
[audio:loading]
Optional tag. The element that will be displayed from the moment the play element is clicked until the audio file is ready to be played, along with the pause element.
📍 Where to add the tag: Any layer, except top-level and container.
[audio:currenttime]
Displays the progressive playing time & the total time of the audio track.
📍 Where to add the tag: A text layer.
[audio:totaltime]
Displays the total time of the audio track.
📍 Where to add the tag: A text layer.
Make sure your phone it's not on mute.

🏷️ How to add the tag

1. Paste the tag [action:play:URL] into the layer name of your play element (can be an icon, shape, button, or text).
2. Paste the tag [action:pause] into the layer name of your pause element (can be an icon, shape, button, or text).
Place the pause element underneath the play element in your design file to make it look synchronized.
3. Paste the tag [audio:currenttime] into the layer name of a text layer. The placeholder time in your design will be replaced by a progressive counter in 00:00 format.
4. Paste the tag [audio:totaltime] into the layer name of a text layer. The placeholder time in your design will be replaced by the real total time of the audio in 00:00 format.
5. [OPTIONAL] Add the tag [audio:background] to the same layer where you added [action:play:URL].
6. [OPTIONAL] Paste the tag [audio:loading] into the layer name of your loading element.
Pro tip: use the Lottie component to easily add a Lottie animation in your intro.
7. Import to Bravo & preview on Bravo Vision 🚀

💾 Example files

Duplicate the files below to see how to set it up!
Bravo Sample - Audio.xd.zip
6MB
Binary
Audio.xd