ios - 由于 "GCKConnectionSuspendReasonNetworkNotReachable",Cast session 暂停

标签 ios objective-c google-cast

观察到的行为:开始播放音乐文件后,用户进入后台。通过 cast 播放音乐文件几分钟后, session 因 GCKConnectionSuspendReasonNetworkNotReachable 原因暂停,即使发送方设备和 cast 设备都连接到正常工作的 Wi-Fi 连接

预期行为: session 应该继续,因为发送方应用程序具有播放音频的后台功能,而且我们还使用 GCKCastOptions 设置了属性 suspendSessionsWhenBackgroundedNO

最佳答案

您可能需要在 GCKRemoteDisplayChannel Class 中检查应用后台运行后的恢复情况

据说,

Normally when an iOS app goes to the background, all network connections are closed and all hardware encoder access is terminated. This effectively means that without special handling a Remote Display session will end upon app backgrounding.

A session can be kept alive in the background by doing the following:

  • Initialize the GCKDeviceManager with initWithDevice:clientPackageName:ignoreAppStateNotifications:, specifying YES as the ignoreAppStateNotifications argument.
  • Register a background task using UIApplication beginBackgroundTaskWithExpirationHandler: to keep the app running if it is backgrounded for an amount of time controlled by iOS.

有关更多信息,您可能还想查看 Playing media while in the background using AV Foundation on iOS .

关于ios - 由于 "GCKConnectionSuspendReasonNetworkNotReachable",Cast session 暂停,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45918375/

相关文章:

ios - Google Cast iOS SDK v3.3 存档上传问题

android - Chrome (Android) -- 转换经过身份验证的 HTML5 视频

ios - 快速管理类范围

objective-c - 在 C 风格方法中访问实例变量

google-cast - 没有媒体的 Chromecast 定制接收器

objective-c - AVPlayer不播放视频

ios - XCode 调试器意外切换当前执行行

ios - UITableView 在部分添加按钮

ios - 在 CABasicAnimation 中闪烁以进行旋转

ios - 如何识别 UIView subview 上的触摸