App companion keeps crashing on this specific screen


i don't understand what i'm doing wrong : ( the other screen doesn't crash tho, only this one!
and the webviewer goes to a gif!

Why are you trying to achieve when Button 1 is clicked? Also your attempting to stop the player after you have opened another screen. Move the Stop block before the if condition.

2 Likes

If you're trying to play a sound while switching screens, you could either play it after switching screens (in the 2nd screen); or play it in the 1st screen, wait for it to complete, and then switch screens, by either using a Clock timer or the Player.Completed event.

2 Likes

when the button's clicked it should open the other screen with a sound playing aswell,


is it like this?

ah i'm not sure how to do that : ( i did this though.. did i do it right?

i've got the screen to stop crashing now! i think it was a problem with one of the files, it was an avif? file instead of a png or jpg.. but anyways the button still won't work..


the player is the background music i want it to stop when you go to the next screen. and a sound effect will play aswell when you press the button. the bgm is about 3 minutes long? if i understand correctly the when player1. completed will only work when the song's finished? i let the music play until it was done then it went to the second screen and went back immediately

And the background music is being played by which component?

the player, and the sound is for the sound effect!

It is not the reason. AVIF was introduced from Android 12, if you are trying to view on devices < 12, then it would just not show the image.

1 Like

This could all be achieved with one Player component, making it much simpler. Try:

where source is the source of the sound you play on the button click.

oohhh i wonder why it stopped crashing suddenly..


the button stopped the player from playing but it didn't go to the next screen : (

First close screen and then open new screen.
Also check Do It result to find value of Player1.Source. I am sure it is not what you are thinking it is.

2 Likes

ooh how do you do do that? sorry i'm still new to all of this..

Swap the "open another screen" and "close screen" blocks.

2 Likes

Connect to Companion.
Right click on block.
Select option named Do It from context menu.
http://ai2.appinventor.mit.edu/reference/other/testing.html

2 Likes

done! button still won't work though..

it worked when i pressed do it on my pc! but when i'm on the companion it still won't work..

Well we need result of it to see what value does that block holds.
You won't see any changes on screen in companion.