Media - Media3/ExoPlayer - Play audio from URLs, local files, and assets - Shoutcast and Icecast Current Song Metadata.

Media
Play audio from URLs, local files, and assets.
Current song metadata on Shoutcast and Icecast
Media3/ExoPLayer 1.9.0-alpha01


Source

Set the media source (URL or file path) to be played.

  • This only prepares the song to be played later when the Play function is called.

Play

Play audio from the current media source.

component_method (10)


Pause

Pause the media.

component_method (11)


Stop

Stop the media playback and release resources.

component_method (12)


Resume

Resume the media from the last paused position.

component_method (13)


Volume

Set the volume of the player (range: 0.0 to 1.0).

blocks (31)


Speed

Set playback speed for audio. Speed must be between 0.1 and 4.0.

blocks (32)


Pitch

Sets the playback pitch. 1.0 is normal pitch, recommended: 0.5 to 2.0.

blocks (33)


SeekTo

Seek to a specific position in milliseconds.

blocks (34)


FastForward

Fast forward the media by specified milliseconds.

blocks (35)


Rewind

Rewind the media by specified milliseconds.

blocks (36)


CurrentPosition

Get the current playback position of the media.

component_method (14)


Duration

Returns the duration of the current audio in milliseconds.

component_method (25)


Next

Play the next song in the playlist.

component_method (15)


Previous

Play the previous song in the playlist.

component_method (16)


SetPlaylist

Set the playlist of songs to be played.

  • songs: paths

GetPlaylist

Get the current playlist of songs.

component_method (17)


SongsCount

Get the total number of songs in the playlist.

component_method (18)


Repeat

Set playback repeat mode.


Shuffle

Enable or disable shuffle mode.

blocks (39)


Loop

Enable looping within a specific range. Provide start and end in milliseconds.

blocks (40)


DisableLoop

Disable the loop mode.

component_method (19)


AlbumArt

Get the album art of a song stored on the device and save it as a file. If no album art exists, it uses an image from assets. Returns the file path.


ClearAlbumArtCache

Clear cached album arts to free up storage space.

component_method (20)


SleepTimer

Set sleep timer in minutes.

blocks (43)


CancelSleepTimer

Cancel sleep timer.

component_method (21)


IsSleepTimerActive

Check if sleep timer is active.

component_method (22)


NotificationContent

Set notification title and content.


NotificationAlbumArt

Updates the notification with the album art of the current song.


StartService

Start the player foreground service.

component_method (23)


StopService

Stop the player foreground service.

component_method (24)


GetMusicFiles

Get audio files of the specified type from the device and set them as a playlist. Use 'All' to fetch all types of audio. Specify sort order: 'title', 'artist', 'album', 'date', 'size', 'duration', or 'filename'.


ConvertToMilliseconds

Convert minutes and seconds to milliseconds.


ConvertToMinutesAndSeconds

Convert milliseconds to minutes and seconds.


SongTitle

Get song title.

component_set_get (6)


ArtistName

Get artist name.

component_set_get (7)


AlbumName

Get album name.

component_set_get (8)


TrackNumber

Get track number.

component_set_get (9)


Year

Get year of release.

component_set_get (10)


Genre

Get music genre.

component_set_get (11)


Composer

Get composer name.

component_set_get (12)


Size

Get file size in readable format.

component_set_get (13)


IsPlaying

Returns true if the player is currently playing.

component_set_get (3)


AudioSessionId

Get Audio Session ID.

component_set_get (4)


CurrentSongIndex

Returns the index of the currently playing song in the playlist. Returns 0 if no song is playing.

component_set_get (5)


FadeDuration

Set the fade-in duration in milliseconds (default: 2000ms).


EnableFadeIn

Enable or disable fade-in effect for all playback.


SourceLoaded

Triggered when the media source has been loaded successfully.

component_event (9)


MetadataUpdated

Triggered when song metadata is updated (currentSong and streamTitle only).

component_event (10)

  • For now, you can only get data in currentSong.

    • streamTitle will not be providing data for now; that will remain pending.
  • currentSong obtains the information set in Current Song from Shoutcast and Icecast.


AudioFocusLost

Triggered when audio focus is lost due to another player starting.

component_event (12)


MediaPlay

Triggered when media starts playing.

component_event (13)


MediaPause

Triggered when media is paused.

component_event (14)


MediaStop

Triggered when media playback is stopped.

component_event (15)


MediaNext

Triggered when the Next function is called.

component_event (16)


MediaPrevious

Triggered when the Previous function is called.

component_event (17)


PlaybackComplete

Triggered when playback of a song is complete.

component_event (18)


PlaylistSet

Triggered when playlist of songs is complete.

component_event (19)


MusicFilesRetrieved

Triggered when audio files are retrieved from the device.


SongIndexChanged

Triggered when the current song index changes.

component_event (20)


SeekPositionChanged

Triggered when the seek position changes.

component_event (21)


SleepTimerTick

Triggered every second while sleep timer is active.

component_event (22)


SleepTimerFinished

Triggered when sleep timer finishes.

component_event (23)


SleepTimerCancelled

Triggered when sleep timer is manually cancelled.

component_event (24)


HeadphonesConnected

Triggered when headphones are connected.


HeadphonesDisconnected

Triggered when headphones are disconnected and playback is paused.


HeadsetButtonPressed

Triggered when a headset button is pressed.


v1.0 Jan 15, 2026.

  • This aia project is an example of how to get the artist and title from Icecast and comes with two other extensions to get the album art and lyrics from a location other than Icecast or Shoutcast.

Media3ExoPlayer.aia (2.2 MB)

joejsanz.joedevmedia.aix (2.2 MB)


JDK: 11
Minimum API Level: 21
Updated On: 2026-01-15T08:00:00Z

Built using: FAST-CLI v5.3.2-premium


Thanks.

1 Like