Please Help With Sound Problem [SOLVED]

I have recently joined App Inventor and I tried following the tutorial "Hello Purr" and followed it exactly but I can't get audio to play. It's not muted and I previewed the sound and it works. I'm on Chrome. I'm trying to get it so that if I press a button it plays music. It has nothing to do with the length either, because I tried a 1 second audio file and it still didn't work. I set the parent for the audio file and everything. This is all the code I used:
image

Thank you for reading this post and God Bless! :smile:

Have you set the source for the sound component ?

yes, I tried to explain that in the post. Thanks for the quick reply.

Are you testing on an Android device (phone?) via the App Inventor Companion?

No, I'm on the computer. How do I test?

Try this example aia project

makeASound.aia (37.4 KB)

Download the MIT App Inventor Companion from Google Play Store onto your phone. From within App Inventor, you can then run your App directly on the phone via the Companion.

Run Companion

Why doesn't it work within the online app inventor designer mode?

Do you mean within the IDE, in the Designer? It is because that is for your GUI (Graphical User Interface) design alone. To make that work live would be a behemoth. However, with the App running in the Companion, you can make changes in the Designer and up date the App with a simple "Refresh" command from the menu. This is by far the best way because you need to know how well your App works on an Android device.

awesome -- thanks!

I tried to upload audio and after 5 seconds it stops. Is there a setting I need to fix?

You need to switch to using the player component for longer sounds, mp3 tunes etc.

2 Likes

how do I do that?

Just select the player component from the media drawer and drag it into your project. Apply your source and other blocks using the blocks available with the player.

Snap3

1 Like

ohhh thanks.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.