切换到iOS 5后无法播放系统声音

编程入门 行业动态 更新时间:2024-10-23 17:39:38
本文介绍了切换到iOS 5后无法播放系统声音的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

这是我在 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后无法播放系统声音

本文发布于:2023-11-11 23:37:16,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1579855.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:切换到   无法播放   声音   系统   iOS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!