iPhone AudioStreamer 无法在后台 OS4 上工作

发布于 2024-09-13 12:16:58 字数 204 浏览 5 评论 0原文

我使用 Matt Galagher 的 AudioStreamer http://github.com/mattgallagher/AudioStreamer/ 它工作正常,但是如何在iPhone OS4上让后台工作呢?

I use Matt Galagher's AudioStreamer http://github.com/mattgallagher/AudioStreamer/ It works fine, however how to make in work at background on IPhone OS4?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

离旧人 2024-09-20 12:16:58

请特别查看文档:

播放音频的应用程序可以在后台继续播放该音频。要指示您的应用程序播放背景音频,请将 UIBackgroundModes 键包含到其 Info.plist 文件中。该键的值是一个包含音频字符串的数组。当此键存在时,系统的音频框架会自动防止您的应用程序在移动到后台时被挂起。只要您的应用程序正在播放音频,它就会继续在后台运行。但是,如果当应用程序移至后台时此键不存在,或者如果您的应用程序在后台停止播放音频,则您的应用程序将被挂起。

您可以使用任何系统音频框架来启动背景音频的播放,并且使用这些框架的过程保持不变。由于您的应用程序在播放音频时不会暂停,因此当您的应用程序在后台时,音频回调会正常运行。在后台运行时,您的应用程序应限制自身只执行提供播放音频数据所需的工作。因此,流音频应用程序将从其服务器下载任何新数据并将当前音频样本推送出去进行播放。

Check out this document, in particular:

Applications that play audio can continue playing that audio while in the background. To indicate that your application plays background audio, include the UIBackgroundModes key to its Info.plist file. The value for this key is an array containing the audio string. When this key is present, the system’s audio frameworks automatically prevent your application from being suspended when it moves to the background. Your application continues to run in the background as long as it is playing audio. However, if this key is not present when the application moves to the background, or if your application stops playing audio while in the background, your application is suspended.

You can use any of the system audio frameworks to initiate the playback of background audio and the process for using those frameworks is unchanged. Because your application is not suspended while playing audio, the audio callbacks operate normally while your application is in the background. While running in the background, your application should limit itself to doing only the work necessary to provide audio data for playback. Thus, a streaming audio application would download any new data from its server and push the current audio samples out for playback.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文