How do I make a playlist of audio files stored in mobile?

Trying to make a playlist of audio files which are already there in the mobile. I saved them in tinydb with filename tag and value would be its activity starter resultUri then displayed through listview. Wish to play the audio file when click on specific listview item. Having error instead : Error 703: unable to load.
Here are some images for your consideration -






Tried to use permission again as above image .... received permission denial error

MusicPlaylist (1).aia (5.3 KB)

Please help to things right.
Thanks

You must request READ permission on all Android versions.

Please tell me how to do so .... ?

image

Thanks .... had tried as shown in second last image but tried it again so get below result.


it opens directory but does not play the sound.
Opening directory is unnecessary. Sound should play as clicked on listview row.

Looks like you may need to convert your content uri to a standard file path ?

AskForPermission should probably go in Screen1.Initialize event handler. not in AfterPicking.

Use DoIt on your ListView1.Selection to see what is being selected. What is selected might not be what you intended depending on your TinyDB tags.

Try this one:

EDIT: GoogleDrive link removed

It should also pick audio files from an external (removable) microSDcard.

You might get some ideas from the Jukebox example at App Inventor Extensions: File | Pura Vida Apps

Taifun

Trying to find out how to do that ..... Please help me with that.

Ma'm, Actually, want to use whole thing in another app so need to understand how it works ..... otherhand we already have apps which have playlists like vlc, google play etc. .... thanks for the app. If you could provide its .aia that would be very nice.

@Taifun Thanks ..... it might be the solution .... let me try.

@SteveJG Listview and tinydb is working ..... Can 20% create problem or as TIMAI2 said need to convert uri to standard file path.

So does it (my test APK) work for you?

No.

This is result

Yes, there was a mistake (on devices without a removalble microSDcard)...
I'll upload the correct APK in 2 min ...

And here is the app that won't re-add the same picked song to the playlist.

Yes .... it working smoothly ... How?

I've made a few small adjustments, in particular the music titles are now added to the playlist immediately and not only after restarting the app.

Its coooolll .... I don't have to reopen the app and change the buttons too ..... thank you so much

1 Like

There were several issues with your app:

  1. The Player component cannot play audio files from a removable SD card.
  2. It works with the URI only when an audio file is picked. And not if you do it later using the ListPicker or ListView. Then a real path (absolute or better full path) is required, because audio files from a removable SDcard can only be played with a full path.
  3. I used the TaifunPlayer from @Taifun in my test app.
  4. I used Sunny's FileTools extension (@vknow360) to get a real path from URI.
  5. I used my MyFonts extension (and MaterialIcons.ttf) for the Play/Pause/Stop buttons.

You now have all the information to try it yourself.

2 Likes