I've been using app inventor for about 2 weeks now for my AP Computer Science Class. We're making a soundboard, and I wanted to program mine so that if I press on a button for a sound while the sound is already playing, it will stop and then play again from the beginning. So I read that .Stop seeks to the start of the audio file after stopping it from playing, and put that in followed by a .Play for the player thinking it will basically restart the audio file. However, as you may conclude from my post here, it doesn't work, and I'm led to believe it's bug as Stop() is supposed to seek to the begging of the song according to the part of the reference page on the Player object. If it instead an error in my code, I can't tell so I will put it below for any who would be able to.
This works for me, if it is what you intend:
If player is not playing then player starts playing the sound
If clickToStop is false
, them the sound is stopped then started from the beginning
If clickToStop is true
, then the sound is stopped
Thank you!
I am also taking APCSP (AP Computer Science Principles) and we must have the same course curriculum because I am also building a soundboard and I have the exact same problem. I know that the my code is working because it stops the audio like it is supposed to but it does not reset to the beginning of the song.
Here is a sample of my code:
It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.
To get an image of your blocks, right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.
Taifun
Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.
Show all relevant blocks.