cocos2d / cocos2d-html5

Cocos2d for Web Browsers. Built using JavaScript.
https://www.cocos.com
3.06k stars 905 forks source link

Fail to play audio inside wechat android version. #2885

Open walzer opened 9 years ago

walzer commented 9 years ago

cocos js 在 android 的微信里面放不出声音。看了一下 是 CCAudio 对浏览器类型判断有问题,希望官方能关注一下(深圳开发者沙龙反馈)

yi commented 9 years ago

谢谢 @walzer

对于 目前的CCAudio.js 我有几点个人的建议想提一下,如下:1

  1. 目前的实现中,针对浏览器类型的判断来决定是否启用 web audio / html5 audio 或者 不开启声音的实现 这个实现会容易跟现实终端情况脱节。 推荐看一下 http://howlerjs.com/ ,这个实现是逐步fallback 下去,这样对于终端各种情况会比较容易兼容。
  2. 目前的 CCAudio.js 的实现是重载 cc.loader 的,对于音效文件的下载在是否可以再优化一下,目前是党目标设备所需要的文件类型无法提供是,会对各种可能类型逐个 http 拉去尝试 。这个实现在实际素材不匹配的适合,会产生一系列无谓的http拉去,特别在 android设备上会卡。个人感觉 howler 提供的策略在开放上更容易使用,就是说 开发者提供我有什么,然后 howler 来挑选优先适合的。
pandamicro commented 9 years ago

I discussed with Yi, and reproduced the audio issue, we believe there is something wrong in the game logic. @yi If you located the issue in the engine logic, please give me an update in this thread, we will look into it.

But we also talked about the current CCAudio design on Android. Many Android browsers don't support multi channel audio, and we decided to disable the playEffect and enable only the playMusic. But what users observe is that the CCAudio is not working on Android.

@VisualSJ We should rethink the design of CCAudio on Android, what do you think ?