IOS设备自动锁屏后再次进入游戏音效失效

IOS设备自动锁屏后再次进入游戏音效失效

【问题描述】

cocos2dx版本2.2.3

IOS设备自动锁屏后再次进入游戏音效失效,在ipad上貌似没出现,不过itouch上面基本都会这样

【定位过程】

1、这个问题以前是有处理过的,不过当时没注意记录,想不起怎么回事了

2、尝试走读代码,对cocos2dx IOS部分音频代码真头疼

3、在百度上找不到解决办法,只能向老外求助了。谷歌被封了,问问Bing吧

最后搜到了cocos2dx社区的一个帖子,问题顺利解决

http://discuss.cocos2d-x.org/t/sound-fx-not-playing-after-a-while/623/26
hawkwoodOct '13
I found a possible solution to my issue, it’s a three parter:
1) CocosDenshion should only pause effects/bgm that is currently playing (see step 9 from previous post) https://github.com/cocos2d/cocos2d-x/pull/394659
2) in AppDelegate.cpp don’t pause/resume the background music, let the OS just fade it out. (I realize this is iOS specific so some modifications may need to accomodate other OSs)
3) (optional?) in AppController.mm add pauseAllEffects and resumeAllEffects to applicationWillResignActive and applicationDidBecomeActive, respectively.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值