Controling player after switching screens

Hi, I got questing if it is a bug or my wrong code.
I got PLAYER1 on screen1 as looping and PlayOnlyInForegroung = false.
If I am on screen, my button Player1 stop is operating well

When I swap to screen2 and then back to screen1 (Music is still playing cus I have PlayOnlyInForegroung = false function is well) but than my stop button didnt do nothing and my music is still playing. When I press button play. The music will start again in second layer (Two same songs are playing with delay) and now the STOP button is working but only for the second layer.

I want tu just make a bacground music throw all screens, but when i swaping screen i cant no more controll the layer.

I try to write variable Bacgrounfmusic.IsPlayin and when I pressing stop/play it is gettign values corectry. But when I swap screen to screen2 and then back to screen1 this variable is FALSE but I still hear the sound from player1. I am ensuring, that I am trying to control this PLAYER1 only from that one screen1. I know I cant control him thro different screen.

Is it bug? Or how can I make it work please?
Thanks to all of you :slight_smile:

I assume you tested this with Companion.
If you have compiled the app (i.e. with the APK), this should not happen.

Nope, just compile app and instaling into two devices. Still doing the same. When i go back to screen the player is playing but varianble Player.IsPlaying = false :frowning:

Show your blocks or post the aia.

image

This procedure I call on screen initializing. Problem is that if I go to screen2 and back to screen1 I got multiple stack of player playing. I expect thet if player bacgroundmusic playing the variable should be true, but it isnt. So if i go to screen2 twice and twice back I got 3 music playing overflow…

Specifically show how you switched the screens.
If you open Screen2 from Screen1 with: open another screen.screenName, Screen1 is not closed, but in the background. Therefore, the player is not stopped.

Try this to switch the screens:

In this case Screen1 is closed after Screen2 opens and if you switch back from Screen2 to Screen1 the Player is NOT playing.

Its not the solution, i need that player to be playing, but i need to have power to control him. If I make this one he will ends. I need to have “power” to controll him if I get back to screen1 :frowning:

What does this mean exactly (example)?

Oh I see your solution. I will try. U are exiting the screen befor comming in, that sounds good. Ill try

No still doing this.
I need that player playing, is it bacground music. But if someone wants to stop it by soundof icon he needs to have power. But I cannot kill the player after switchning schreen by other way then kill the screen. I got variables in…

I just dont get how is posible, that when that music is playing the player dont know it is playing. That must be bug, cus I dont killing screen just swaping, but after that swap the playr just loose information that he is playing

Try this:

I have complete control over the Player if I switch back from the Screen2 to Screen1.

playerTest.aia (141.2 KB)

1 Like

No, everthing is working fine as expected: playerTest2.aia (141.6 KB)

No it isnt :slight_smile: I tryed your aia. When u get back from screen one. Your label has value “” and IsPlaying is false. Try after getting back from a screen click Button 1. It will play second layer od sound :frowning:

I mean back from screen2 sorry.

So when i get back to screen1 and pressing your button1 it will place second music layer. But It shouldnt the player has only 3 states Pause, play and stop. There is nothing like a multiple list playing

No, see here (tested on several devices (Android 8, 9):

test

1 Like

I tested the .aia and this doesn't happen on my device.
What device are you using and what android OS version does it have?

1 Like

Hi !
I've got the same problem, and I tried your .aia but it doesn't work on my phone.
When I play the song, go on the Screen2, and return on the first screen, if I click on button1, the music starts again on a new layer, and if I click on button3, the music of the second layer stops but the music on the first layer doesn't.
I really don't understand... Can you help me please ?
Is there any solutions ? Is this a bug caused by my phone or computer ?
Thanks

Hi all, I have this situation:
on the initial screen i have a Player that playes an mp3 as background music.
Changing screen the music still play and it's OK.
in another screen i have a button that launches video player component. Can I pause the mp3 player for watching the video without background music and then resume the mp3 player when the video stops ?

I don't know how do this because the player controls doesn't appears in the blocks screen with the video component

use virtual screens, so you will be able to do it, see tip1 here

Taifun


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