App Inventor Extensions

Audio Player Extension

See the App Inventor Extensions document about how to use an App Inventor Extension.

For questions about this extension or bug reports please start a new thread in the App Inventor community. Thank you.

For feature requests please contact me by email. To be a sponsor of a new method already is possible starting from only 10 USD! With your contribution you will help the complete App Inventor community. Thank you.

July 18th, 2016: Initial version.

Aug 11th, 2016: Version 1a: avoid DX execution failed error: build each extension separately

Aug 27th, 2016: Version 1b: android.permission.VIBRATE added

March 23rd, 2017: Version 1c: bugfix PAUSE

March 30th, 2017: Version 1d: bugfix file not found

May 12th, 2018: Version 1e: bugfix memory leak for frequently starting and stopping sounds, see also here.
Thank you Fábio for your donation!

Jan 2nd, 2021: Version 1f: SDK29 fix for path to assets


Enhanced Player Extension. Note: Minimum API Level is 16, Android 4.1, Jelly Bean.

The extension is a copy of the MIT Player component and fixes a Loop issue, which occurs for Android versions API 22 and newer using this workaround. Thank you moonzai! The implementation of the workaround as extension was sponsored by Johannes. Thank you!

Also there have been added the CurrentPosition and the Duration properties and the StartAt method. Thank you Peter for being the sponsor of these blocks.

Required permissions: android.permission.READ_EXTERNAL_STORAGE, android.permission.INTERNET


Returns the current position of the currently playing audio file in milliseconds. Player must be in status PLAYING or PAUSED to be able to return the current position.
Sponsor of this property is Peter. Thank you!

Returns the duration of the currently playing audio file in milliseconds Player must be in status PLAYING or PAUSED to be able to return the duration.
Sponsor of this property is Peter. Thank you!

Reports whether the media is playing

Reports whether the playing should loop

If true, the player will loop when it plays. Setting Loop while the player is playing will affect the current playing.

Gets the policy whether playing should only work in foreground.

If true, the player will pause playing when leaving the current screen; if false (default option), the player continues playing whenever the current screen is displaying or not.

Return the audio source.

Set the audio source.
Prefix the filename with / (i.e. relative path) to look for the file on the SD card. For instance /mySound.mp3 will look for the file /mnt/sdcard/mySound.mp3. To read assets packaged with an application (also works for the Companion) start the filename with // (two slashes). If a filename starts with file:/// you can specify a complete path to the file. You also can assign an URL, just start the filename with http then.


Notes: CheesyGonzales reported in the forum, that he did not have success to set the audio source to a file on the external sdcard. However Hussein reported by email, that this worked fine for him on a Samsung Galaxy Note3 running Android 5.0. Unfortunately I do not have such device, so I can't test this.

Returns whether Warnings should be suppressed

Specifies whether Warnings should be suppressed

Sets the volume to a number between 0 and 100.



Start from the beginning. If the player is in status PAUSED, the playing is resumed.

Start at a given position.
Precondition: player must be in status PLAYING or PAUSED and position must be < duration.
Sponsor of this method is Peter. Thank you!


Vibrates for specified number of milliseconds.


This event fires when loop has been triggered

This event fires when loop has been triggered

This event is signaled when another player has started (and the current player is playing or paused, but not stopped).

Player Test App

Known Issues

Questions and Answers

Q1: Out of curiosity, do the new functions work with an http URL?
A: The functionality is in the UI thread (same as the App Inventor Player component) and not in a separate thread, which means, the app is blocking and most probably you get a runtime error while trying to start a file from a http URL at a given position. I recommend you to use the StartAt method only together with audio files stored as asset or on sdcard.

Q2: I just tested your extension on two devices and if I use the Duration block it gives different duration. There are 3 ms of offset. I think depend of android version?
A: I'm using this very simple method. There was reported something similar on Stackoverflow. You might want to try the suggestions there.

For questions about App Inventor,
please ask in the App Inventor community.Thank you.

Terms and Conditions


Developing and maintaining snippets, tutorials and extensions for App Inventor takes a lot of time.
I hope it saved some of your time. If yes, then you might consider to donate a small amount!

Donation amount:

or donate some mBTC to Bitcoin Address:

Thank you! Taifun

Download TaifunPlayer extension (aix file)
Download Player Test app (aia file)
Back to top of page ...

Creative Commons License
This work by Pura Vida Apps is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License
with attribution (name=Pura Vida Apps and link to the source site) required.

Home | Snippets | Tutorials | Extensions | Links | Search | Privacy Policy | Contact