🏃♂️ AudioExoPlayer
An extension for MIT App Inventor 2.
Specifications
Package: pl.patryk_f.exoplayer
Size: 2,50 MB
Version: 2.1
Minimum API Level: 21
Updated On: 2025-10-02T22:00:00Z
Help URL: Learn more
Built & documented using: FAST v5.2.0-premium
Multi-Components
AudioExoPlayer
Audio player based on the ExoPlayer library. Developed by Patryk F. by Fast.
Events:
AudioExoPlayer has total 5 events.
1. Looped
This event fires when loop has been triggered
2. SourceLoaded
This event fires when source has been loaded and is ready to play
3. Completed
This event indicates, that media has reached the end
4. OnError
An event triggered when an error occurs in the player. The block returns the error number, the error name, and a message describing the error.
Parameter | Type |
---|---|
errorNumber | number |
errorName | text |
message | text |
5. AudioFocusChanged
Triggered when audio focus changes
Parameter | Type |
---|---|
focusLoss | boolean |
Methods:
AudioExoPlayer has total 5 methods.
1. SeekTo
Start at a given position. Precondition: player must be in status PLAYING or PAUSED and position must be < duration.
Parameter | Type |
---|---|
position | number |
2. Play
Start from the beginning. If the player is in status PAUSED, the playing is resumed.
3. Pause
Pauses the player. Player must be in status PLAYING.
4. Stop
Stops the player and sets the current position to the beginning. Player must be in status PLAYING, PREPARED or PAUSED.
5. FormatTime
Converts duration in milliseconds to human-readable time in hours, minutes, and seconds.
- Return type:
text
Parameter | Type |
---|---|
millis | number |
Setters:
AudioExoPlayer has total 4 setter properties.
1. Source
Set the audio source. Local file paths, server file urls, and uris are accepted.
- Input type:
text
- Helper type:
asset
2. Loop
If true, the Player will loop when it plays. Setting Loop while the player is playing will affect the current playing.
- Input type:
boolean
3. PlayOnlyInForeground
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.
- Input type:
boolean
4. Volume
Sets the volume to a number between 0 and 100
- Input type:
number
5. MultiScreen
Allows the player to play on multiple screens.
- Input type:
boolean
Getters:
AudioExoPlayer has total 7 getter properties.
1. Source
Get the audio source.
- Return type:
text
2. IsPlaying
Returns information about whether the player is currently playing.
- Return type:
boolean
3. Loop
Returns true if the Player will loop when it plays; false otherwise.
- Return type:
boolean
4. PlayOnlyInForeground
Returns true if the Player will pause playing when leaving the current screen; false otherwise.
- Return type:
boolean
5. Volume
Gets the volume as a number between 0 and 100
- Return type:
number
6. Duration
Returns the duration of the current media item in milliseconds, or 0 if the duration is not known.
- Return type:
number
7. CurrentPosition
Returns the playback current position in milliseconds.
- Return type:
number
PlayerView
A module that extends the capabilities of AudioExoPlayer, allowing you to create a player view with the necessary controls. Developed by Patryk F. by Fast.
Event:
PlayerView has total 1 event.
1. FullScreenButtonClicked
Triggered when fullscreen button is clicked.
Methods:
PlayerView has total 5 methods.
1. InitializePlayer
Initializes the player view within the given container for the given player. We can also specify the type of surface to render video, or disable the surface for audio sources.
Parameter | Type |
---|---|
container | component |
player | component |
renderingSurfaces | RenderingSurfaces (helper blocks) |
- Enums for RenderingSurfaces:
None
,SurfaceView
,TextureView
,SphericalView
,VideoDecoderGlSurfaceView
2. SetControllerAutoHide
Sets the playback controls timeout. The playback controls are automatically hidden after this duration of time has elapsed without user input and with playback or buffering in progress.
Parameter | Type |
---|---|
timeoutMs | number |
3. ShowCustomErrorMessage
Sets a custom error message to be displayed by the view. The error message will be displayed permanently, unless it is cleared by passing epty string to this method.
Parameter | Type |
---|---|
errorMessage | text |
4. HideController
Hides the playback controls.
5. ShowController
Shows the playback controls.
Setters:
PlayerView has total 20 setter properties.
1. ShowBuffering
Sets whether a buffering spinner is displayed when the player is in the buffering state. The buffering spinner is not displayed by default.
- Input type:
ShowBuffering
- Helper type:
ShowBuffering
- Helper enums:
Never
,WhenPlaying
,Always
2. ControllerAutoShow
Sets whether the playback controls are automatically shown when playback starts, pauses, ends, or fails.
- Input type:
boolean
3. ControllerHideOnTouch
Sets whether the playback controls are hidden by touch events.
- Input type:
boolean
4. ControllerShowTimeoutMs
Sets the playback controls timeout. The playback controls are automatically hidden after this duration of time has elapsed without user input and with playback or buffering in progress.
- Input type:
number
5. ControllerAnimation
Set if the controller should show/hide with animation.
- Input type:
boolean
6. ShowFullScreenButton
Sets the visibility of the full screen button.
- Input type:
boolean
7. SetFullScreenState
Sets whether the player is currently in fullscreen, this will change the displayed icon.
- Input type:
boolean
8. ShowFastForwardButton
Sets the visibility of the fast forward button.
- Input type:
boolean
9. ShowRewindButton
Sets the visibility of the rewind button.
- Input type:
boolean
10. ShowNextButton
Sets the visibility of the next button.
- Input type:
boolean
11. ShowPreviousButton
Sets the visibility of the previous button.
- Input type:
boolean
12. ShowShuffleButton
Sets the visibility of the play button.
- Input type:
boolean
13. ShowRepeatButton
Sets the visibility of the given repeat button.
- Input type:
RepeatMode
- Helper type:
RepeatMode
- Helper enums:
Off
,One
,All
14. ResizeMode
Sets the resize mode for the video view.
- Input type:
ResizeMode
- Helper type:
ResizeMode
- Helper enums:
Fit
,FixedWidth
,FixedHeight
,Fill
,Zoom
15. ShowSubtitleButton
Sets the visibility of the subtitle button.
- Input type:
boolean
16. ShutterBackgroundColor
Sets the background color of the shutter view.
- Input type:
number
17. TimeBarScrubbingEnabled
Sets whether the time bar should seek immediately as the user drags the scrubber around (true), or only seek when the user releases the scrubber (false).
- Input type:
boolean
18. UseController
Sets whether the playback controls can be shown. If set to false the playback controls are never visible and are disconnected from the player.
- Input type:
boolean
19. ArtworkDisplayMode
Sets whether and how artwork is displayed if present in the media.
- Input type:
ArtworkDisplayMode
- Helper type:
ArtworkDisplayMode
- Helper enums:
Off
,Fit
,Fill
20. DefaultArtwork
Sets the default artwork to display if ArtworkDisplayMode is Fit or Fill and no artwork is present in the media.
- Input type:
text
Getters:
PlayerView has total 6 getter properties.
1. ControllerAutoShow
Returns whether the playback controls are automatically shown.
- Return type:
boolean
2. ControllerHideOnTouch
Returns whether the playback controls are hidden by touch events.
- Return type:
boolean
3. ControllerShowTimeoutMs
Return the playback controls timeout. The playback controls are automatically hidden after this duration of time has elapsed without user input and with playback or buffering in progress.
- Return type:
number
4. ResizeMode
Get the resize mode for the video view.
- Return type:
ResizeMode
5. UseController
Returns whether the playback controls can be shown.
- Return type:
boolean
6. IsControllerFullyVisible
Returns whether the playback controls are fully visible.
- Return type:
boolean
Release notes
Show
v1.0:
- basic version
v1.1:
- added support for multi-screen playback (MultiScreen property block)
v1.2:
- update to the latest version of the Media3-1.8.0 library
v1.3:
- fixed stream playback error (HTTP 403) by setting proper User-Agent header
v2.0
- added AudioFocusChanged event
- added PlayerView component
- fixed error reporting in the OnError event
v2.1
- fixed AudioFocusChanged event
Download
Extensions:
Older version
- v1.0 - pl.patryk_f.exoplayer.aix (2.0 MB)
- v1.1 - pl.patryk_f.exoplayer.aix (2.0 MB)
- v1.2 - pl.patryk_f.exoplayer.aix (2.1 MB)
- v1.3 - pl.patryk_f.exoplayer.aix (2.1 MB)
- v2.0 - pl.patryk_f.exoplayer.aix (2.5 MB)
- v2.1 - pl.patryk_f.exoplayer.aix (2.5 MB)
Example: ExoPlayerTest2 (5).aia (2.2 MB)