Deutsche Version   Deutsche Version


Version Adjustments
1.0 (2024-10-12) Initial version
1.1 (2025-03-19) The availability of the internal fields of the player component depends on the order in which the components are initialized by App Inventor.
The PlayerToUse property is therefore no longer available as a Designer property. It must be activated at runtime, e.g. in the Screen.Initialize event.

Motivation

I have always used the Taifun Player for my audio projects because it has more functions than the Player component in the App Inventor. On my current smartphone, the Taifun Player stops after about 20 minutes. However, the AI2 Player component continues to run throughout. This extension adds additional functions to the AI2 player component.


Download

The ZIP-Archiv UrsAI2PlayerAddon for downloading. The archive contains the source code, the compiled binary for uploading to the App Inventor and a sample application.

Usage

A player component must be assigned to the extension at runtime, e.g. in the Screen.Initialize event.

The additional functions mentioned in the reference are then available.

Reference

Properties

CurrentPosition
Returns the current position of the currently playing audio file.
Duration
Returns the duration of the currently playing audio file.
IsRunningInCompanion
Returns wether the app is running in the companion.
PlayerToUse
Player component to extend
Version
Returns the component's version name.
VersionSDK
Returns running Android SDK version.

Functions

SeekTo (MilliSeconds)
Seeks to specified time position.
StartAt (MilliSeconds)
Start at a given position.

Events

Error handling

Errors are reported via the Screen.ErrorOccurred event.

Code Text Comment
18040 Component not of type 'Player'. Affected property is PlayerToUse.
18041 Cannot access internal field 'player'. Affected property is PlayerToUse.
18042 'Player' component not initialzed yet. Affected property is PlayerToUse.

Example

Test-App

Launcher Icon

A small example app shows the use of the extension (see Download).


In the example, the AI2 Player component is used to play a song. The UrsAI2PlayerAddon extension is used to realise fast forward and rewind.

Screenshot Screenshot of the App.

Tools

For developing own extensions I gathered some tips: AI2 FAQ: Develop Extensions.