这是我在 iOS 4 中播放哔音效果:
This is how I played a beep sound effect in iOS 4:
SystemSoundId beepOnSoundId; CFURLRef soundUrl = CFBundleCopyResourceURL( CFBundleGetMainBundle(), CFSTR("beep"), CFSTR("wav"), NULL ); // soundUrl logged: // file://localhost/var/mobile/Applications/ ... beep.wav AudioServicesCreateSystemSoundID(soundUrl, &beepOnSoundId); // beepOnSoundId logged: 4097 AudioServicesPlaySystemSound(beepOnSoundId);当我将设备升级到 iOS 5 时,它停止工作。我什么也听不到。
It stopped working, when I upgraded my device to iOS 5. I hear nothing. I logged out all the variables and none were nil or 0.
在 iOS 5 中API的更改如何破坏我的声音播放代码?
How has the API changed in iOS 5 that breaks my sound playing code?
问题可能是因为我有一个 AVCaptureSession 运行时,我播放声音。 iOS 5不知何故不让你这样做。
The problem may be because I have an AVCaptureSession running while I play the sound. iOS 5 somehow doesn't let you do this anymore. I need to play a beep sound while I am recording something from the camera.
推荐答案此 bug report 可能与您的问题相关,如果您有AVCaptureSession正在运行。
This bug report could be related to your question, if you have an AVCaptureSession running.
在iOS 5下,当使用AudioServicesPlaySystemSound调用时,如果有一个音频设备处于活动状态的AVCaptureSession,将不会工作。
Under iOS 5, when using an AudioServicesPlaySystemSound call, it will not work when there is an active AVCaptureSession with an audio device active.
更多推荐
切换到iOS 5后无法播放系统声音
发布评论