From 4f48500ec98b92fb6f30965c68b2ef29650086ea Mon Sep 17 00:00:00 2001 From: Outis Date: Tue, 7 May 2019 14:33:40 +0800 Subject: [PATCH] [bug] fix a bug of stack overflow It happens when audioId === undefined in preload callback --- adapter/InnerAudioContext.js | 8 +- test/assets/Adapter/rt-wx-adapter.js | 8 +- test/assets/Scene/main.fire.meta | 2 +- .../resources/prefab/ui_media.prefab.meta | 3 +- test/settings/builder.json | 23 ++- test/settings/project.json | 23 +-- test/settings/services.json | 146 ++++++++++++++++++ 7 files changed, 190 insertions(+), 23 deletions(-) create mode 100644 test/settings/services.json diff --git a/adapter/InnerAudioContext.js b/adapter/InnerAudioContext.js index 19aa492..1eb254b 100644 --- a/adapter/InnerAudioContext.js +++ b/adapter/InnerAudioContext.js @@ -101,12 +101,16 @@ class InnerAudioContext { _map.get(_this)["_cbManager"].onFunctionCallback(cbArray); } - if (_this.autoplay === true && audioEngine.getState(_map.get(_this)['_audioId']) !== _map.get(_this)['_PLAYING']) { + var audioId = _map.get(_this)['_audioId']; + if (audioId === undefined) { + return; + } + if (_this.autoplay === true && audioEngine.getState(audioId) !== _map.get(_this)['_PLAYING']) { _this.play(); } _map.get(_this)["_preloaded"] = true; - if (_map.get(_this)['_audioId'] !== undefined && audioEngine.getState(_map.get(_this)['_audioId']) === _map.get(_this)['_PLAYING']) { + if (audioEngine.getState(audioId) === _map.get(_this)['_PLAYING']) { var cbArray = _map.get(_this)["_cbManager"].getFunctionCallbackArray("onPlay"); if (cbArray !== undefined) { _map.get(_this)["_cbManager"].onFunctionCallback(cbArray); diff --git a/test/assets/Adapter/rt-wx-adapter.js b/test/assets/Adapter/rt-wx-adapter.js index c702fa5..cd796cf 100644 --- a/test/assets/Adapter/rt-wx-adapter.js +++ b/test/assets/Adapter/rt-wx-adapter.js @@ -490,12 +490,16 @@ var InnerAudioContext = function () { _map.get(_this)["_cbManager"].onFunctionCallback(cbArray); } - if (_this.autoplay === true && audioEngine.getState(_map.get(_this)['_audioId']) !== _map.get(_this)['_PLAYING']) { + var audioId = _map.get(_this)['_audioId']; + if (audioId === undefined) { + return; + } + if (_this.autoplay === true && audioEngine.getState(audioId) !== _map.get(_this)['_PLAYING']) { _this.play(); } _map.get(_this)["_preloaded"] = true; - if (_map.get(_this)['_audioId'] !== undefined && audioEngine.getState(_map.get(_this)['_audioId']) === _map.get(_this)['_PLAYING']) { + if (audioEngine.getState(audioId) === _map.get(_this)['_PLAYING']) { var cbArray = _map.get(_this)["_cbManager"].getFunctionCallbackArray("onPlay"); if (cbArray !== undefined) { _map.get(_this)["_cbManager"].onFunctionCallback(cbArray); diff --git a/test/assets/Scene/main.fire.meta b/test/assets/Scene/main.fire.meta index 2bff939..b17fbbe 100644 --- a/test/assets/Scene/main.fire.meta +++ b/test/assets/Scene/main.fire.meta @@ -1,5 +1,5 @@ { - "ver": "1.0.0", + "ver": "1.0.1", "uuid": "2d2f792f-a40c-49bb-a189-ed176a246e49", "asyncLoadAssets": false, "autoReleaseAssets": false, diff --git a/test/assets/resources/prefab/ui_media.prefab.meta b/test/assets/resources/prefab/ui_media.prefab.meta index dcb0794..c112dea 100644 --- a/test/assets/resources/prefab/ui_media.prefab.meta +++ b/test/assets/resources/prefab/ui_media.prefab.meta @@ -1,8 +1,7 @@ { - "ver": "1.0.0", + "ver": "1.0.1", "uuid": "91d8e1e2-192a-4871-abfa-13b3255a295c", "optimizationPolicy": "AUTO", "asyncLoadAssets": false, - "readonly": false, "subMetas": {} } \ No newline at end of file diff --git a/test/settings/builder.json b/test/settings/builder.json index acf8df9..63eebb8 100644 --- a/test/settings/builder.json +++ b/test/settings/builder.json @@ -1,17 +1,12 @@ { - "appKey": "", - "appSecret": "", "encryptJs": false, "excludeScenes": [], "fb-instant-games": {}, - "includeAnySDK": false, "includeSDKBox": false, "inlineSpriteFrames": true, "inlineSpriteFrames_native": true, - "jailbreakPlatform": false, "md5Cache": false, "mergeStartScene": false, - "oauthLoginServer": "", "optimizeHotUpdate": false, "orientation": { "landscapeLeft": true, @@ -20,7 +15,6 @@ "upsideDown": false }, "packageName": "org.cocos2d.helloworld", - "privateKey": "", "qqplay": { "REMOTE_SERVER_ROOT": "", "orientation": "portrait" @@ -33,5 +27,20 @@ "orientation": "portrait" }, "xxteaKey": "c2bc529e-e890-4e", - "zipCompressJs": true + "zipCompressJs": true, + "baidugame": { + "appid": "testappid", + "orientation": "portrait", + "REMOTE_SERVER_ROOT": "", + "subContext": "" + }, + "android-instant": { + "REMOTE_SERVER_ROOT": "", + "pathPattern": "", + "scheme": "https", + "host": "", + "skipRecord": false, + "recordPath": "" + }, + "appBundle": false } \ No newline at end of file diff --git a/test/settings/project.json b/test/settings/project.json index 59e7f39..7d9bbde 100644 --- a/test/settings/project.json +++ b/test/settings/project.json @@ -1,11 +1,5 @@ { - "cocos-analytics": { - "appID": "13798", - "appSecret": "959b3ac0037d0f3c2fdce94f8421a9b2", - "channel": "", - "enable": false, - "version": "" - }, + "assets-sort-type": "name", "collision-matrix": [ [ true @@ -34,17 +28,28 @@ "Intersection", "Native NetWork" ], + "facebook": { + "appID": "", + "audience": { + "enable": false + }, + "enable": false, + "live": { + "enable": false + } + }, "fit-height": true, "fit-width": false, "group-list": [ "default" ], + "last-module-event-record-time": 1557209333574, "simulator-orientation": false, "simulator-resolution": { "height": 640, "width": 960 }, + "start-scene": "current", "use-customize-simulator": false, - "use-project-simulator-setting": false, - "start-scene": "current" + "use-project-simulator-setting": false } \ No newline at end of file diff --git a/test/settings/services.json b/test/settings/services.json new file mode 100644 index 0000000..23ba335 --- /dev/null +++ b/test/settings/services.json @@ -0,0 +1,146 @@ +{ + "services": [ + { + "service_id": "235", + "service_name": "Cocos Analytics", + "service_desc": "提供最核心最基本的数据、标准化界面功能简洁易用、数据准确性最好", + "service_title": "精准了解游戏的新增、活跃、留存、付费等数据", + "service_icon": "https://account.cocos.com/client/3f8f31ccf66995e183044f167c092395.png", + "service_guide_url": "https://n-analytics.cocos.com/docs/", + "service_sample_url": "https://github.com/cocos-creator/tutorial-dark-slash/tree/analytics", + "service_dev_url": "http://analytics.cocos.com/realtime/jump_to/", + "service_type": "3", + "service_type_zh": "公司和个人游戏", + "support_platform": [ + "Android", + "iOS", + "HTML5" + ], + "package_download_url": "http://download.cocos.com/CocosServices/plugins/service-analytics/1.1.7_2.0.3.zip", + "package_version_desc": "1、 更新 H5 SDK 版本至 2.0.3。
2、 SDK 优化更新,删除 init 接口字段 'channel' ,改为 login 接口输入。
3、 如有相关问题咨询或者需求, 可以联系我们技术支持邮箱 support-cocos@cocos.com", + "service_component_name": "service-analytics", + "package_versions": [ + "1.0.0_1.0.5", + "1.1.2_2.0.0", + "1.1.3_2.0.1", + "1.1.4_2.0.1", + "1.1.5_2.0.1", + "1.1.6_2.0.1_2.0.2", + "1.1.7_2.0.3" + ], + "build_platform": [ + "web-mobile", + "web-desktop", + "fb-instant-games", + "wechatgame", + "wechatgame-subcontext", + "qqplay", + "android", + "android-instant", + "ios", + "mac", + "quickgame", + "qgame", + "huawei" + ] + }, + { + "service_id": "241", + "service_name": "Matchvs", + "service_desc": "通过SDK接入快速实现联网功能、帧同步、国内外多节点、服务器独立部署、gameServer自定义游戏服务端逻辑。\n技术支持群QQ群:822523258", + "service_title": "专业成熟的移动游戏联网与服务端解决方案", + "service_icon": "https://account.cocos.com/client/14406719a07eb3d714d36e5edc6e06fa.png", + "service_guide_url": "http://doc.matchvs.com/QuickStart/QuickStart-CocosCreator", + "service_sample_url": "http://www.matchvs.com/serviceCourse", + "service_dev_url": "http://www.matchvs.com/cocosLogin", + "service_type": "2", + "service_type_zh": "仅支持公司游戏", + "support_platform": [ + "Android", + "iOS", + "HTML5" + ], + "package_download_url": "http://download.cocos.com/CocosServices/plugins/service-matchvs/1.0.6_3.7.9.2.zip", + "package_version_desc": "更新日期:2019-03-20
更新内容:
1、添加多节点相关接口
2、优化独立部署wss和ws切换
3、优化login参数容错
4、添加组队中踢人和消息发送接口
5、添加取消组队匹配接口", + "service_component_name": "service-matchvs", + "package_versions": [ + "1.0.3_3.7.6.4", + "1.0.5_3.7.7.3", + "1.0.6_3.7.9.2" + ], + "build_platform": [ + "web-mobile", + "web-desktop", + "fb-instant-games", + "wechatgame", + "wechatgame-subcontext", + "qqplay", + "android", + "android-instant", + "ios", + "mac", + "quickgame", + "qgame", + "huawei" + ] + }, + { + "service_id": "242", + "service_name": "Agora Voice", + "service_desc": "稳定、低耗、76ms超低延时、全球200+数据中心覆盖;变声器、超高音质、听声辩位等丰富玩法极速接入;全平台支持:Android、iOS、Web。\n技术支持群QQ群:799099183", + "service_title": "游戏内置实时语音SDK", + "service_icon": "https://account.cocos.com/uploads/client_icon/date(\"Y-m-d\")/50fe52b789c2fc1e1fff9eec161c1bb3.png", + "service_guide_url": "https://docs.agora.io/cn/Interactive Gaming/game_c", + "service_sample_url": " https://github.com/AgoraIO/Voice-Call-for-Mobile-Gaming/tree/master/Basic-Voice-Call-for-Gaming/Hello-Cocos-Creator-Voice-Agora", + "service_dev_url": "https://sso.agora.io/api/oauth/cocos/login", + "service_type": "3", + "service_type_zh": "公司和个人游戏", + "support_platform": [ + "Android", + "iOS", + "HTML5" + ], + "package_download_url": "http://download.cocos.com/CocosServices/plugins/service-agora/1.0.1_2.2.3.20_2.5.2.zip", + "package_version_desc": "first release.", + "service_component_name": "service-agora", + "package_versions": [ + "1.0.1_2.2.3.20_2.5.2" + ], + "build_platform": [ + "web-mobile", + "web-desktop", + "android", + "ios" + ] + }, + { + "service_id": "7", + "service_name": "AnySDK", + "service_desc": "800+渠道、支持多平台多引擎、安全稳定的本地打包工具。技术支持:https://forum.cocos.com/c/anysdk", + "service_title": "游戏快速接入第三方SDK的解决方案", + "service_icon": "https://account.cocos.com/client/3ba1fcf9029140cf08d95813e387d04a.png", + "service_guide_url": "http://docs.anysdk.com", + "service_sample_url": "http://github.com/AnySDK", + "service_dev_url": "http://dev.anysdk.com", + "service_type": "0", + "service_type_zh": "不支持游戏", + "support_platform": [ + "Android", + "iOS", + "HTML5" + ], + "package_download_url": "http://download.cocos.com/CocosServices/plugins/service-anysdk/1.0.1_2.2.5.zip", + "package_version_desc": "修复 Creator 2.0.x 系列版本 2.0.7 以上因调用 cc.game.restart(); 而导致的 AnySDK 调用失败的错误", + "service_component_name": "service-anysdk", + "package_versions": [ + "1.0.1_2.2.5" + ], + "build_platform": [ + "web-mobile", + "web-desktop", + "android", + "ios" + ] + } + ] +}