用slider滑动来修改音乐、音效音量,调用cc.audioEngine.setVolume()时,浏览器能正常运行,模拟器和原生安卓都会报错。
大脑们,能否为在下解惑哈
下面是提供demo
NewProject.zip (3.1 MB)
-
Creator 版本:2.1.3、2.4.7 都报错
-
目标平台:浏览器正常, iOS Android 模拟器报错
-
重现概率:100%
报错日志:
2022-01-20T11:30:40.753Z - normal: Simulator: D/jswrapper (130): JS: Cocos Creator v2.1.3
2022-01-20T11:30:40.856Z - normal: Simulator: D/jswrapper (149): JS: start _musicId: 0
2022-01-20T11:30:41.816Z - normal: Simulator: D/jswrapper (149): JS: this._musicId: 0
2022-01-20T11:30:41.816Z - normal: Simulator: D/jswrapper (149): JS: this._musicVolume: undefined
2022-01-20T11:30:41.816Z - normal: Simulator: D/jswrapper (149): JS: num: 0.20
2022-01-20T11:30:41.817Z - error: Simulator: E/jswrapper (416): jsb: ERROR: File …\cocos\scripting\js-bindings\auto\jsb_cocos2dx_audioengine_auto.cpp: Line: 416, Function: js_audioengine_AudioEngine_setVolume
E/jswrapper (416): js_audioengine_AudioEngine_setVolume : Error processing argumentsE/jswrapper (423): [ERROR] Failed to invoke js_audioengine_AudioEngine_setVolume, location: …\cocos\scripting\js-bindings\auto\jsb_cocos2dx_audioengine_auto.cpp:423
at HTMLElement.print-simulator-log (D:\CocosCreator_2.1.3\resources\app.asar\editor\builtin\scene\panel\messages\scene.js:1:1669)
at Object.e._dispatch (D:\CocosCreator_2.1.3\resources\app.asar\editor-framework\lib\renderer\panel.js:1:1941)
at EventEmitter.o.on.s (D:\CocosCreator_2.1.3\resources\app.asar\editor-framework\lib\renderer\ipc.js:1:2921)
at emitMany (events.js:127:13)
at EventEmitter.emit (events.js:204:7)
2022-01-20T11:30:41.841Z - normal: Simulator: D/jswrapper (149): JS: this._musicId: 0
2022-01-20T11:30:41.841Z - normal: Simulator: D/jswrapper (149): JS: this._musicVolume: 0.20
2022-01-20T11:30:41.841Z - normal: Simulator: D/jswrapper (149): JS: num: 0.21
2022-01-20T11:30:41.841Z - error: Simulator: E/jswrapper (416): jsb: ERROR: File …\cocos\scripting\js-bindings\auto\jsb_cocos2dx_audioengine_auto.cpp: Line: 416, Function: js_audioengine_AudioEngine_setVolume
E/jswrapper (416): js_audioengine_AudioEngine_setVolume : Error processing arguments
at HTMLElement.print-simulator-log (D:\CocosCreator_2.1.3\resources\app.asar\editor\builtin\scene\panel\messages\scene.js:1:1669)
at Object.e._dispatch (D:\CocosCreator_2.1.3\resources\app.asar\editor-framework\lib\renderer\panel.js:1:1941)
at EventEmitter.o.on.s (D:\CocosCreator_2.1.3\resources\app.asar\editor-framework\lib\renderer\ipc.js:1:2921)
at emitMany (events.js:127:13)
at EventEmitter.emit (events.js:204:7)
2022-01-20T11:30:41.841Z - error: Simulator: E/jswrapper (423): [ERROR] Failed to invoke js_audioengine_AudioEngine_setVolume, location: …\cocos\scripting\js-bindings\auto\jsb_cocos2dx_audioengine_auto.cpp:423
at HTMLElement.print-simulator-log (D:\CocosCreator_2.1.3\resources\app.asar\editor\builtin\scene\panel\messages\scene.js:1:1669)
at Object.e._dispatch (D:\CocosCreator_2.1.3\resources\app.asar\editor-framework\lib\renderer\panel.js:1:1941)
at EventEmitter.o.on.s (D:\CocosCreator_2.1.3\resources\app.asar\editor-framework\lib\renderer\ipc.js:1:2921)
at emitMany (events.js:127:13)
at EventEmitter.emit (events.js:204:7)
2022-01-20T11:30:41.857Z - normal: Simulator: D/jswrapper (149): JS: this._musicId: 0
2022-01-20T11:30:41.857Z - error: Simulator: E/jswrapper (416): jsb: ERROR: File …\cocos\scripting\js-bindings\auto\jsb_cocos2dx_audioengine_auto.cpp: Line: 416, Function: js_audioengine_AudioEngine_setVolume
E/jswrapper (416): js_audioengine_AudioEngine_setVolume : Error processing argumentsE/jswrapper (423): [ERROR] Failed to invoke js_audioengine_AudioEngine_setVolume, location: …\cocos\scripting\js-bindings\auto\jsb_cocos2dx_audioengine_auto.cpp:423
at HTMLElement.print-simulator-log (D:\CocosCreator_2.1.3\resources\app.asar\editor\builtin\scene\panel\messages\scene.js:1:1669)
at Object.e._dispatch (D:\CocosCreator_2.1.3\resources\app.asar\editor-framework\lib\renderer\panel.js:1:1941)
at EventEmitter.o.on.s (D:\CocosCreator_2.1.3\resources\app.asar\editor-framework\lib\renderer\ipc.js:1:2921)
at emitMany (events.js:127:13)
at EventEmitter.emit (events.js:204:7)