gpt4 book ai didi

ios - 如何使用 UIWebView 或 WKWebView 在后台连续播放音乐

转载 作者:行者123 更新时间:2023-11-28 21:18:21 65 4
gpt4 key购买 nike

在我的应用程序中实现的网站会播放一系列 mp3 文件,当应用程序处于事件状态时它运行良好,但是当我按 HOME 按钮或锁定手机时,它不能在后台播放超过一首歌曲,之后, 应用暂停。我已经尝试设置不同类型的AVAudioSession Category,但没有用。

最佳答案

我假设您没有启用audio 后台模式。这就是Apple documentation说:

When the UIBackgroundModes key contains the audio value, the system’s media frameworks automatically prevent the corresponding app from being suspended when it moves to the background. As long as it is playing audio or video content or recording audio content, the app continues to run in the background. However, if recording or playback stops, the system suspends the app.

所以看起来你只需要启用audio 背景模式。这是 Ray Wenderlich's tutorial on background modes

关于ios - 如何使用 UIWebView 或 WKWebView 在后台连续播放音乐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40755735/

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