Audio player

RFO-BASIC! provides an interface to the Android Media Player. This lets a BASIC program play music, podcasts, and stream audio from the Internet.

The file types you can play depend on your device and the version of Android it runs. Here is a partial summary:
 * Supported file types

 

Files of type PLS cannot be played by the Media Player, unlike some audio programs. These files are not media but playlists.

For a current list of supported file types, refer to the Android documentation.

Many BASIC programs use the Android Media Player to play music indefinitely while the device is unattended. Unfortunately, the Media Player is temperamental when used this way. Once your audio application works correctly, you should test it on other versions of Android, and on other makes of device, especially before publishing it for general use.
 * Stability issues

The Media Player runs in the background using the Android AsyncTask class. This implementation avoids interruptions and warning dialogs. However, your program may stop playing music:
 * If it is in the foreground but the user switches off the display, such as by pressing a hardware button or closing a flip-phone.
 * If the user presses the HOME button and your program does not handle that event with the ONBACKGROUND: interrupt routine.
 * If it is running on a Samsung device that gets plugged into a recharger.

To avoid being interrupted, a music player program can have an ONBACKGROUND: and ONBACKKEY: interrupt handlers. It can use the timer interrupt with a NOTIFY statement, as the Android core will not stop apps that have an active notification. The user may be instructed to use Android developer's settings to select less active power management.