How to play a BGM and know current playback time on in cocos2d ios?(如何在 cocos2d ios 中播放 BGM 并知道当前播放时间?)
问题描述
我正在开发一款基于音乐的 IOS 游戏,需要在背景音乐和全局计时器之间严格同步,所以我正在寻找一种播放音乐的方式,同时知道音乐的确切位置每次更新帧时都在播放.
I'm working on a IOS game based on music, and a strict synchronize between background music and global timer is necessary, so I'm looking for some way to play music AND at the same time knowing which exact position the music is playing on at each frame update.
OALSimpleAudio
没有这种接口.有没有更好的解决方案?谢谢!
the OALSimpleAudio
Doesn't have such kind of interface. Are there any better solution? Thank you!
推荐答案
OALSimpleAudio Background-Music (OALAudioTrack) 使用 AVAudioPlayer.
OALSimpleAudio Background-Music (OALAudioTrack) uses the AVAudioPlayer.
试试:
[[[[OALSimpleAudio sharedInstance] backgroundTrack] player] currentTime]
这篇关于如何在 cocos2d ios 中播放 BGM 并知道当前播放时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在 cocos2d ios 中播放 BGM 并知道当前播放时间?


- 用 Swift 实现 UITextFieldDelegate 2022-01-01
- 在测试浓缩咖啡时,Android设备不会在屏幕上启动活动 2022-01-01
- 如何检查发送到 Android 应用程序的 Firebase 消息的传递状态? 2022-01-01
- 想使用ViewPager,无法识别android.support.*? 2022-01-01
- Android viewpager检测滑动超出范围 2022-01-01
- MalformedJsonException:在第1行第1列路径中使用JsonReader.setLenient(True)接受格式错误的JSON 2022-01-01
- Android - 我如何找出用户有多少未读电子邮件? 2022-01-01
- 使用自定义动画时在 iOS9 上忽略 edgesForExtendedLayout 2022-01-01
- android 4中的android RadioButton问题 2022-01-01
- Android - 拆分 Drawable 2022-01-01