gpt4 book ai didi

iOS 音频/声音不会在后台模式处于事件状态时在后台播放

转载 作者:行者123 更新时间:2023-12-04 17:17:08 25 4
gpt4 key购买 nike

我的应用程序(使用 Flutter 制作,但这应该无关紧要)具有类似于计时器的功能,可以定期(10 秒到 3 分钟)发出滴答声。我在我的 Info.plist 中激活了背景模式 Audio、AirPlay 和 Picture in Picture 以及以下内容。

    <key>UIBackgroundModes</key>
<array>
<string>audio</string>
</array>

但在后台运行时音频仍然会停止。

在配置文件模式下运行应用程序时会发生这种情况,当我在 Debug模式下运行时,音频在后台运行时继续。

如何让音频继续在后台运行?

最佳答案

有一个relevant note在 audio_service 0.18.0 自述文件中可以提供帮助:

Note that the audio background mode permits an app to run in the background only for the purpose of playing audio. The OS may kill your process if it sits idly without playing audio, for example, by using a timer to sleep for a few seconds. If your app needs to pause for a few seconds between audio tracks, consider playing a silent audio track to create that effect rather than using an idle timer.

关于iOS 音频/声音不会在后台模式处于事件状态时在后台播放,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68442752/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com