【问题标题】:iOS 13 - WkWebView: audio stops when in backgroundiOS 13 - WkWebView:在后台时音频停止
【发布时间】:2019-12-22 21:36:13
【问题描述】:

我有一个应用程序使用 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 中不会发生,音频在后台正常播放。

【问题讨论】:

标签: swift wkwebview avaudiosession ios13 ios-background-mode


【解决方案1】:

我猜你正在使用电容器。

我遇到了和你一样的问题,看起来关于“不存在后台任务”的最后一个错误与 Capacitor 的 BackgroundTask 插件有关,无论你是否使用它 (BackgroundTask.swift )

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

编辑:仅在使用 HTML5 音频时才会发生。

【讨论】:

  • 有人找到解决办法了吗?
猜你喜欢
  • 1970-01-01
  • 2017-12-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-03-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多