cc.audioEngine.play changed ?( Cocoscreator2.4.2 )

I want to update a myapp working in an old version.(cocoscreator 1.9.3)

I downloaded Cocoscreator2.4.2 and I made my app by this new version Cocoscreator.

There was music I wanted to play forever(Even if the scene changes).
So I use this source↓↓↓

var timeCallback = function (dt) {
cc.audioEngine.play(this.start_bgm, true, 1);
}
this.scheduleOnce(timeCallback, 1);

I could play music forever in cocoscreator 1.9.3.

If I made this code↓

var timeCallback = function (dt) {
cc.audioEngine.play(this.start_bgm, true, 1);
this.scheduleOnce(timeCallback, 1);

var timeCallback_2 = function (dt) {
cc.director.loadScene("1day")
}
this.scheduleOnce(timeCallback_2, 3);

But… I could not play music forever in this program(cocoscreator 2.4.2)

Is there easy solution?

I would be grateful if someone teach me…

I test your code on web browser, but didn’t reproduce your problem.


        var timeCallback = function (dt) {
            cc.audioEngine.play(this.start_bgm, true, 1);
        }
        this.scheduleOnce(timeCallback, 1);
        
        var timeCallback_2 = function (dt) {
            cc.director.loadScene("test")
        }
        this.scheduleOnce(timeCallback_2, 3);

do you mean that the bgm stopped when the scene changes and can’t be played anymore ?
and can you tell which platform you meet this problem ?

1 Like

Thank you for reply.

Yes…


  1. (Scene 1)bgmA start
    →After Scene1 is loaded, I’m running this program →cc.director.loadScene(“Scene2”)

  2. (Scene 2)bgmA stop…
    ※I want to play bgmA forever.


I use macbookpro 2020(os Catalina).
This phenomenon occurs cocoscreator’s defalut simulator.

bgmA(audioclip) is mp3 data.

※I appreciate your efforts. Thank you for your cooperation.
※I’m working on improving my English.

Strange, I can’t even reproduce the problem you met on the Simulator Preview,
Could you upload a demo project so i can check out what the problem is ?

Sorry for the late reply.
I uploaded a sample project.

Would you mind checking my App project?

Sample.zip (7.8 MB)