▶ MediaSessionPlayer - Play audio in the background, with Media3 ExoPlayer

There are no standards like the ones you're talking about. Everyone has extension blocks at their disposal and can create an application that works the way they want. I like this method and I implemented it in a test application.

Besides, I wonder if I published this topic in the "Extensions" or "App Showcase" section. I'll check.

Hmm, the section is correct, so why is the main topic of the conversation about the operation of the test application?

Yes, there is no doubt that this is just a side note in the context of your extension. And that is exactly what I called it. However, I have been using CD players and (later) MP3 players for more than 40 years, and they all worked like I say. So it was and is standard. Period. (Regardless of how modern Android apps handle it today.)

1 Like

Hi Patryk,

Thanks for the tips to refresh database and for making this extension and sample aia.

Just some feedback:
I noticed there is a number 3 in front of the tracks time.
It also appears in the list.
(shown in yellow rectangle on picture)

The track time indicated is supposed to be 4:23

Interesting. Have you changed anything in the blocks?

No, nothing done to the blocks. I just compiled the aia and installed it.

This song that shows it lasts 40:21 actually lasts 0:21?

The song Child In Time shown as 40:21 is actually 10:21

Updated the extension to version 1.1.

  • fixed FormatTime method which in some cases returned incorrect time
1 Like

Hi Patryk,

Is it possible for MediaSessionPlayer to just play from a folder that I select, instead of getting all songs from device at first start of app?

I have a file selector which returns a list of songs as shown below and can play them one after the other in my listview based on the way it is in the folder or folders.

My list of songs in its folders looks like this:

"/storage/111E-3028/Music/Battle Beast FLAC/2011 - Steel/01. Enter the Metal World.flac",
"/storage/111E-3028/Music/Battle Beast FLAC/2011 - Steel/02. Armageddon Clan.flac",
and so on

Thanks.

Yes, you can build your own list instead of using automatic search. In the sample project, in the resources there is a json file with a sample list. But I think I can add some sort of filter in the form of a given folder. I'll have to check that.

The tracks you provided are from an external physical micro SD card? I haven't tested the player with an SD card.

I did, it works.

1 Like

The sample tracks shown are from external physical micro sd card.
I couldn't get it to read from there - it was like stuck trying to read all music files.

But it works well reading from internal memory.

Did you try his test aia? I have no problem to get all audio files also from a removable micro SDcard (e.g. on a Galaxy Note8, Android 9).

Updated the extension to version 1.2.

  • modified CreatePlaylistFromDevice block to allow selecting any folder
  • added ContentUriToPath block to allow using FilePicker to select a folder
1 Like

Updated the extension to version 1.3.

  • changed folder selection logic, empty folderPatch will allow searching all available external storages
2 Likes

Thanks for the updated extension and aia.
it can play from folders.

Also it can load and play songs from external physical micro sd card too.

Will play around with it and feedback. :grinning:

Hello can we use this app for a stream as well? if yes how? thanks.

Yes, you can create your own playlist to which you can add links to streams. In the sample application, in the resources there is an example of a list. You just need to use another block to read this list instead of files from the device. I can later make some very simple example of such an application.

With a small modification of the apk, we can also use this player with android auto.

1 Like

For example, can it play internet radio links? What if we want to listen to music with a list of radio channels, not an mp3 list?

Instead of building a list of local mp3 files you can build a list of URLs. You just need to know the URLs.

Perhaps I'll find some time over the weekend to prepare an example.

1 Like