Player - Device Audio, Loop - Play Streaming

Player
Play audio from URLs, local files and assets.
Play music with the MediaPlayer SDK.

StartService

Starts the foreground player service.

component_method (4)


StopService

Stops the foreground player service.

component_method (5)

  • You can turn off the screen without entering Doze mode.
    A foregroundService is being used.

NotificationAlbumArt

Get the song's cover art to be displayed in the notification.

  • songPath: Path to the song.
  • imageIfTherIsntOne: If there is no cover art embedded in the song, an image is set from the assets.


NotificationContent

Sets the title and content for the notification that is displayed while the service is running.

  • The SetNotificationContent block is optional, but defaults to these values:

    • title: Playing
      content: Audio playback in progress

Play

Play audio from application assets, local files, or remote URLs.

Example Usages:

  • Playing a local file from external storage:
Play("/storage/emulated/0/Music/song.mp3");
  • Playing a file from the web:
Play("https://www.example.com/path/to/song.mp3");

Repeat

Set the repeat mode.

  • repeatMode: RepeatMode helper block with these options:
    • repeatAll
    • repeatOne
    • repeatOff

Shuffle

Set songs to shuffle mode.

blocks (15)


Loop

Calling the function causes playback to loop for the time set in the start and end parameters.

blocks (16)

  • start: Start time in milliseconds.
  • end: End time in milliseconds.
    The set song segment will not stop playing until you call the DisableLoop function.

DisableLoop

Disable loop playback, the song will continue to play normally.

component_method (6)


Previous

Go back to the previous song.

component_method (7)

Shuffle mode does not apply here, the song will be returned to the index before the current one.


Next

Go to the next song.

component_method (8)

Shuffle mode applies to Next if enabled.


Pause

Pauses the current audio playback.

component_method (9)


Stop

Stop the media playback and release resources.

component_method (15)


Resume

Resume the media from the last paused position without losing audio focus.

component_method (16)


Volume

Sets the volume of the left and right channels of the media player.
Each channel can be configured separately.

blocks (23)

Volume value:
0.0 Mute volume
1.0 Maximum volume
Default value: 0.5


GetMusicFiles

Set the type of audio file you want to get.

  • audioType: "MP3"

    • Input types: MP3, AAC, WAV, OGG, AMR, FLAC, MIDI, MP4, M4A, MKA.

Setting All will get all audio types.


GetPlaylist

Get the list of songs set in SetPlaylist.

component_method (14)


PlaybackSpeed

Set the playback speed (0.5 to 2.0 recommended).

blocks (21)

  • speed: The number must be greater than 0.0.

Pitch

Adjust the MediaPlayer playback pitch.

blocks (22)

  • 1.0 is normal pitch, recommended: 0.5 to 2.0.

CurrentPosition

Get the current playback position of the media.

component_method (13)


ConvertToMilliseconds

Convert minutes and seconds to milliseconds.


ConvertToMinutesAndSeconds

Convert milliseconds to minutes and seconds.


SeekTo

Seek to a specific position in milliseconds.

blocks (20)


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.


SongsCount

Get the total number of songs in the playlist.

component_method (12)



IsPlaying

Returns true if the media player is currently playing.

component_set_get (10)


SongTitle

Get song title.

component_set_get (1)


ArtistName

Get artist name.

component_set_get (2)


AlbumName

Get album name.

component_set_get (3)


TrackNumber

Get track number.

component_set_get (4)


Year

Get year of release.

component_set_get (5)


Genre

Get music genre.

component_set_get (6)


Composer

Get composer name.

component_set_get (7)


Size

Get file size in readable format.

component_set_get (8)


Duration

Returns the duration of the current audio in milliseconds.

component_set_get (9)


AudioSessionId

Get MediaPlayer Sessión ID.

component_set_get (11)

  • When playing audio, you are given a session ID, when you stop the audio, that ID is lost.
    Pausing does not lose the ID.

Can use with an Equalizer extension I created separately.


CurrentSongIndex

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

component_set_get (12)



AudioFocusLost

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

component_event (8)


SetPlaylist

Event triggered when playlist of songs is complete.

component_event (9)


MusicFilesRetrieved

Event triggered when audio files are retrieved from the device.

  • Provides lists of:

paths, titles, artists, albums, durations, tracks, years, genres, composers, sizes, displayNames and bitRates.


MediaPlay

Triggered when media starts playing.

component_event (12)


MediaPause

Triggered when media is paused.

component_event (11)


MediaStop

Triggered when media playback is stopped.

component_event (13)


MediaNext

Triggered when the Next function is called.

component_event (15)


MediaPrevious

Triggered when the Previous function is called.

component_event (16)


PlaybackComplete

Set playback speed for audio.

component_event (14)


SongIndexChanged

Triggered when a new song starts

component_event (17)



Update: v1.2 Ago 30, 2025.

  • AIX file size reduced: from 945.1 KB to 30.9 KB.

  • Some functions also had their names changed somewhat.

  • Events have been renamed, removing the On.

  • Playback from Assets was failing; this has now been fixed. The Play function will also play from Assets, so the PlayFromAssets function is no longer necessary.

    • These functions and events have been removed: GetAllAssetMusicFiles, PlayFromAssets, and OnAssetMusicFilesRetrieved.
  • The following properties have been added:

    • TrackNumber - Gets the track number

    • Year - Gets the year of release

    • Genre - Gets the music genre

    • Composer - Gets the composer's name

    • Size - Gets the file size


Player.aia (2.2 MB)

joejsanz.joedevplayer.aix (30.9 KB)


JDK: 11
Minimum API Level: 21
Updated On: 2025-08-30T07:00:00Z

Built using: FAST-CLI v4.3.1-premium


Thanks.

14 Likes

Hola @Joejsanz .

He visto que la extension reproduce (local files)
Pregunto. ¿Que tipo de formatos reproduce?
Lo pregunto por curiosidad, no estoy por hacer ningún proyecto que involucre el uso de audio pero me genero duda. Hace tiempo que estoy buscando alguna extension que maneje mp3s de forma fluida, pero no he tenido suerte con los que encontré, no se ajustaron a mis necesidades pasadas.
En fin. Va un like por el proyecto.
Pd. Generalmente no escribo en castellano, pero sabiendo que sos de Mexico me pareció correcto escribirlo así.

1 Like

Means?

is this able to control streaming services too? Like Spotify for example.

Muchas gracias @German_Skena

Los formatos que puede agarrar son:

  • MP3 (.mp3)
  • WAV (.wav)
  • AAC (.aac)
  • MIDI (.mid, .midi)
  • OGG (.ogg)
  • AMR-NB (.amr)
  • AMR-WB (.awb)

Estos últimos 3, la disponibilidad puede variar según el dispositivo Android y sus códecs específicos.

  • FLAC (.flac)
  • 3GP (.3gp)
  • M4A (.m4a): MPEG-4 Audio

.flac no lo he probado, pero los 2 últimos agarran bien en mi dispositivo android 11.

1 Like

Right now it's not possible, I have not tested that function, I will investigate that.
@Damiano_Zedda

1 Like
1 Like

Hmm, where is the .Play method for audio files from external storage?

(I checked and found that the "url" socket can also be used for an absolute path. But it is at least confusing.)

1 Like

Admittedly it's confusing since it accepts an absolute path, I'll change it to say path.

Today I realized that my memory card is damaged and only receives music from the internal storage,

I'm going to look at that and add that feature.

Regarding internal and external storage see here: Some basics on Android storage system

I have formatted my memory card and I have verified that the GetAllMusicFiles function effectively captures all the mp3 music on the device, internal and external.

I also changed the name of the .Play function parameter and added usage examples.

This is a full path, not an absolute path. Maybe it's working with that too. I didn't check. But if this works too, it might also work with the PrivateDir. I'll check later...

1 Like

Thank you so much Anke

Where is the new exension version?

Did you check your extension with the APK? There are permission errors (at least on Android 13+).

I'll check that out later, as soon as I can get the computer.

I think I missed adding this READ_MEDIA_AUDIO for when it is android 13+

1 Like

Yes, but even if I request this permission (i.e. automatically declare it in the Manifest), a storage permission error is thrown.

Please check your extensions beforehand also with the compiled app.

I've been struggling to get my laptop to work, it only lasts 2 minutes and turns off, I think I'll need another one, anyway...
I haven't been able to review the code, but if I'm not mistaken, the code fails because I didn't set the READ_MEDIA_AUDIO permission to the Manifest when creating the extension.

I don't think so, because (as I already said) I declared this permission in the Manifest, requested it und got the permission error anyway.

1 Like

Find a program to monitor CPU heat.
Sounds like a clogged or failing fan.

1 Like