iOS 13-WkWebView:后台停止音频

问题描述 投票:12回答:1

我有一个使用WkWebView播放来自Soundcloud的音频的应用,在iOS 13 Beta 6上,当该应用不在前台时,音频会停止,即使在背景模式中打开了[[音频。

开始播放时,将抛出此断言:

Error acquiring assertion: <NSError: 0x282cf67c0; domain: RBSAssertionErrorDomain; code: 2; reason: "Required client entitlement is missing"> { userInfo = { RBSAssertionAttribute = <RBSLegacyAttribute: 0x1592432e0; requestedReason: MediaPlayback; reason: MediaPlayback; flags: PreventTaskSuspend | PreventTaskThrottleDown | WantsForegroundResourcePriority>; }

进入背景状态后,将抛出以下声明并暂停音频:

Can't end BackgroundTask: no background task exists with identifier 13 (0xd), or it may have already been ended. Break in UIApplicationEndBackgroundTaskError() to debug. [ProcessSuspension] Background task expired while holding WebKit ProcessAssertion (isMainThread? 1).

在iOS 12中不会发生这种情况,在iOS 12中,音频在后台正常播放。
swift wkwebview avaudiosession ios13 ios-background-mode
1个回答
0
投票
您在使用电容器吗?

我遇到了与您相同的问题,我认为关于“不存在后台任务”的最后一个错误与电容器的BackgroundTask插件有关,无论您是否使用它(BackgroundTask.swift)] >

很明显,iOS 12和iOS 13之间有所变化,但是到目前为止,还没有弄清楚如何定义背景音频所需的权利。

© www.soinside.com 2019 - 2024. All rights reserved.