How do I pause/start music player with one button?

I am trying to pause and start background music with one button. How do we code this? Thanks!

well here is the algorithm for it -

set the button text to start then 
when button click 
if button text = start 
start the player
set button text to pause
pause the player
set button text to start

1 Like

well i told the same thing :sweat_smile:

yes but maybe blocks help more

1 Like


Note: This yellow marked block is only necessary if the sound is not looped.
If it is looped, there will be gaps between the loops (transitions) with the Player component. To avoid this, you have to use the TaifunPlayer extension and OGG format instead of MP3.


Got it thank you everyone!


i know this is an old post i'm sorry but could someone @EmiratesFan001 @preetvadaliya show me an image from the designer page of this happening and not the blocks please

Hello Hottunez

Just make a test file using the Blocks as shown.

i've done this as shown


have i done this rite with the buttons in designer?


You are using 2 Buttons...
The idea of this thread is to use only 1 Button


1 Like

so should i remove all thats circled

Try this one: playPause.aia (314.7 KB)


rite were does the aia go

:question: -

You should only use 1 button and not 2

A very good way to learn App Inventor is to read the free Inventor's Manual here in the AI2 free online eBook ... the links are at the bottom of the Web page. The book 'teaches' users how to program with AI2 blocks.
There is a free programming course here and the aia files for the projects in the book are here:
How to do a lot of basic things with App Inventor are described here: .

Also do the tutorials Our Tutorials! to learn the basics of App Inventor, then try something and follow the Top 5 Tips: How to learn App Inventor


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

It is best if you work the blocks out yourself. Don't take AIAs for granted. :slight_smile: Also, please do not promote your help topics elsewhere. Wait for a user to read your post and respond.

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