Improving the player component

Hello everybody,
Once again I am collecting information about what is currently not working in a specific App Inventor component and what could be improved. This time I’m writing about the player component. Some issues are fixed in specific extensions, but I don’t know of any free extension which fixes all issues

1 Seamless looping

Seamless looping currently does not work on devices with Android 6 or higher

2 Position and Seek

This is really basic music player functionality, which is currently not supported natively

3 Background Playing

Currently, the play back stops when the device goes into sleep mode

Many thanks to @Anke who has written a conclusion about what is not working in which extension here


Also, it seems that the player behaves differently on different manufacturer’s phones, so extensive testing is necessary

3 Likes

This does not apply to the Player component or the Taifun extension.
(The latter is also based on the Media Player from Android with an additional looping function).

Both are also playing in the background (means here, when the screen is not visible (after pressing the device Home button) or the app is in standby (idle mode, screen off).

With the Player Component:

There are many factors that can cause the audio output to stop and it depends on whether you are playing a Local media file or Streaming audio.

On my Samsung Galaxy S8 running Android OS v9.0 when Streaming, the audio play back will stop when the device goes to sleep, unless I disable Battery Optimization:

When Optimization is disabled the app will usually continue to produce audio for about 5 minutes. However if I plug my phone into a charger it will continue to play until I stop it.

In my observations:
When playing a local file, the OS may shut down the app to save the battery.

Additionally, when Streaming, the OS may shut down Mobile Internet access to save data or shut down wifi to save battery.

What does this mean? Does the sound stop after a while?

I have been working with AI and then AI2 with music and sounds since my first days (since 2013) and have more than 18 test devices and tens of thousands of users. So far, I am not aware of one case in which a sound that is played from the assets is interrupted in standby (sleep mode). Many users use the apps to fall asleep and still listen to the music the next morning if they forget to activate the timer.

Unfortunately, things look different at Kodular with the ExoPlayer. There (depending on how often you deactivate the battery optimization via clock: com.puravidaapps.TaifunBatteryOptimization.aix) the app stops after about 1-20 minutes. because of the old support library (and the obsolete ExoPlayer version) it actually stutters the sound and later it stops.

See here:

1 Like

4 The player doesn’t react to headphone buttons

Not really an issue, but I think that the component should take control over that.

2 Likes

I have tried and failed multiple times to achieve this, and I am not the only one:

2 Likes