Sound not working properly when compiled to APK

I have a game with 2 stage. When in stage 1, I play music bgm1.ogg on channel 1 and when in stage 2 i switched to bgm2.ogg (still channel 1) which is working properly when open it in desktop browser

But when compiled to apk, stage 2’s BGM is overlapping with stage 1’s BGM

I tried to changing it to different channel:

  • bgm1.ogg on channel 1
  • bgm2.ogg on channel 2
  • On stage 2, stop channel 1 and play channel 2
  • Still not working in apk (music is overlapping each other)

Can’t find any reference regarding this too in this forum :frowning:

Anyone has a solution?

Which apk export method did you use?

Have you tried with Intel XDK?

The fact it works as attended in browser indicates the issue is within the apk generation.

Yep, I’m using Intel XDK

Also try this too

But sound still take a long time to load (no overlap again)

Instead of stopping the channel, try to mute it to see what happens.

Not working too. Still overlapping each other :frowning:

Have you tried to check off or on “stop all sounds and musisc at start up” in the scene properties??

Yep, already checked
fyi, music and sound is working properly in desktop browser
the problem is just when compiled to apk

btw here is my events

I have tried:

  • Changing time scale to at the beginning of scene
  • Play music bgm1.ogg (using this action causing music to overlapping when restart scene)
  • Play music bgm1.ogg on channel 1 (problem is still same as above)
  • Play sound bgm1.ogg (this one is not overlapping, but need a long time to start bgm1.ogg)

all of these is working in desktop browser but not apk :frowning:

Don’t check it. I had same problem in my game Jumpy The Spider that music sound over another (yep, browser good, in mobile not works). I used 2 global variables (Music and musicstop) and 1 music channel. I’m not sure are those 2 variables necessary, maybe 1 is ok, but I don’t change it because it’s working. You can download Jumpy the spider files and search how I did it, maybe it helps.

It’s working when you only have 1 stage, the “Play music of channel 1” really do the job.
In my case, i have 3 stage with each stage have different BGM
Stage 1 is working properly right now (thanks to you :wink: )
But problem arises when in stage 2 or above
I can’t stop the stage 1’s BGM (it’s still playing in another stage), even though i already use “Play the music stage2.ogg on channel 1” (same channel as stage 1’s BGM)
Sadly, the “Stop the music of channel 1” didn’t do anything in android either :frowning:

Am I missing something? :confused:

Did you add the music in the library, or are you calling it directly in the events?

But in my game I also got 2 stages: menu and the level screen ad when I jump between those it has the same problem and I got also 3 stages when I worked with hiscore stage (I don’t think it’s matter that you have many different music or only one). You should try use some global variables. Stop the channel end of the stages etc. :smiley: It would be easier to solve this if we got the project and could test by ourselves :smiley:

Directly :slight_smile:

I tried to compile your game to apk
In yours, the stage BGM is still playing when back to menu too :confused:

Thanks for telling me about it, I did not remember that! But I solved that problem and I think you can do this thing in your game. Put channel 1 music volume to 0 and channel 2 volume 100 etc.

Have you tried to run in in android?
I did this too before, but it isn’t working in android

Yes, android.

Not working in my side
I have stage 1 playing bgm1.ogg and stage2 playing bgm2.ogg

Now I tried with 3 dfferent scenes with 3 different music. This works. :smiley: Download the rar file and see how I did it (Named “This Works!”). I add pictures too in the rar file. (Can’t upload all images here because 3 files is max).

Edit. Blogger post with pics about this:
This Works!.rar (113 KB)

This won’t do, because you’re eating resources playing all musics while only one is audible.
I’m not even sure how an android terminal will react if forced to play several bgm at once…

This issue looks like the one I had a few years ago.
Took some time to be resolved (dec 2014). It was an issue with soundmanager.js, which wasn’t sending proper values.

Seems it’s back. I wish I could say I’m surprised…

Well question was how it make work and that how it’s working :smiley: But yeah you are right about that it eating recourses. I am trying to improve events now.