cocos2d-x怎么暂停循环播放的背景音乐

cocos版本:2.2.2

onload()使用cc.audioEngine.play(this.bgm,true,1)方法循环背景音乐,cc.audioEngine.pause(this.bgm)方法却不能暂停音乐,cc.audioEngine.stop(this.bgm)方法也不行,音量调为0也不行

怎么才能暂停或者停止循环播放的音乐呢?

if(this.bgm)

        cc.audioEngine.stop(this.bgm);

    else

        cc.audioEngine.stopAll();

cc.audioEngine.playMusic(bgm, loop);//播放背景音
cc.audioEngine.pauseMusic();//暂停背景音
cc.audioEngine.resumeMusic();//恢复播放背景音
cc.audioEngine.stopMusic();//暂停播放背景音

cc.audioEngine.stop的参数是cc.audioEngine.play返回的id。let id = cc.audioEngine.play(this.bgm,true,1);cc.audioEngine.stop(id)

反复试了,可行,但是参数用loop报错,还是用true(2.2.2版本,不知道其他版本是否可用)。音量参数在这个方法中不起作用,可以不写。
多谢!

返回的id初始值=1,这个值好像是播放的次数。cc.audioEngine.stop(id)这个方法没有用。

该主题在最后一个回复创建后14天后自动关闭。不再允许新的回复。