Is there any way to play an audio file from a list selection?

I am trying to have an audio file play as a result of a list selection. This is what my app interface looks like:

Post your (relevant) blocks.

Problem: I need to figure out how to play an audio file when a list selection is made. I want the corresponding audio file to play for that specific selection. Here is my code:

Screenshot 2023-10-15 16.15.13
Screenshot 2023-10-15 16.14.58

I am running this on the Chromebook companion.

Here is the updated version of my interface:

Sorry for 3 replies, but the outcome of this code is a 'Runtime Error' where 'Elements' does not accept the audio file:

Screenshot 2023-10-15 16.20.33

How can I fix this?

Post the blocks without the error message and the aia.

I don't see the place where you tell the Music Player what music file to play.

1 Like

I don’t have any content in my Player. I see why this is a problem, but I am trying to get it so that if I click on Play then it will play the first item in the list, then the next, then the last. Shuffle will choose one at random to play.

Where does the audio source come from? Where is it stored?

So if I were to have an audio play for each item in the list, do I need a player for each item? If so, how would I have it find the item in the list and play that audio?

No you do not need a separate Player.

See Taifun's Jukebox example (that is part of his File extension) App Inventor Extensions: File | Pura Vida Apps for code that does most of what you desire. :wink:

No.

Just answer my question: Where do the audio files come from - where are they stored?

The audio files come from my device and are inputted into the app. I do not know what you mean by where they are stored.

Where and in which folder on your device are these audio files located?

For example:

They are located in the files application through my Google drive folder.

Ok, you have to put the respective GD direct links in Player.Source.

grafik

1 Like

Would I download the Jukebox V2? Thank you.

Yes
This is the only version you can download
Taifun

Thank you everyone for your help! I have figured out how to set it to the audio I wanted it to play. While it doesn't exactly solve my problem, it satisfies my needs for the app. Here is the fix:

Screenshot 2023-10-16 15.07.34