Player component start stop problem

On my App in the settings menu, I set 2 buttons to on or off a media file via player. Here are the blocks:
and this is a screenshot of settings menu:

WhatsApp Image 2021-02-11 at 16.50.14
They are working perfect. When I click the on button, the music begins and the backgroundcolor changes. The same is the off button.

But the problem is, if I open another screen and came back to main screen, I want to stop it automatically. But the music is still playing. When I open the settings menu, the buttons positions looks like the custom position as the image here at the beginning: Off. And although I press the off button, the music doesn't stop. And the funny thing is, when I press the on button, a second music is starting to play while the first music is still going on. What's wrong here???

This has to do with how you switch screens. Show the blocks and post the aia. Also post what exactly, how and when should happen. Should the music stop when the new screen is opened or when you return to the screen?

The aia file is very complex. I send you the blocks from main screen. If I change the screen, the music should keep playing, and its actually doing it. But if I return to the main screen, the music should stop. In the settings menu, I want to recall the music again through the on off buttons. When Screen1.initialize, do call Player1.stop doesn't work.

how do you return to the main screen?
are you using The recommended method of switching screens in App Inventor


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

Try one of these blocks on Screen1, both should work for your purpose:


You are not switching screens correctly.

If you re-open the main screen, then you will have the sound from the Main Screen and the re-opened Main Screen.
Instead of the open another screen block you need to use the close screen block.

So, I read the tutorials about working with multiple screens. That was the main problem in my app. I decided to work with one screen using the vertical arrangements as virtual screens. This is very easier and not complicate. Thanks for your support.

This is (usually) a good decision. But my approach also works with multiple screens.

It also interfears with the UI. With multiple screens, you can easily set an animation, but no animation(by using arrangements) also gives an awesome design.
You decide. I usually create my apps with mulyiple screens, but both techniques are good!

It's also worth checking if your extra Arrangements are doing the same thing, but with different text, sound, and images.

If so, check into keeping tables of the text, sound, and images, and reloading just one set of components from that table as needed.

That would reduce your block count significantly.