谷歌Chromecast SDK TearDown在后台 [英] Google Chromecast SDK TearDown in background

查看:123
本文介绍了谷歌Chromecast SDK TearDown在后台的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用iOS发件人API框架,当我的应用程序进入后台时,SDK会删除所有连接,并且在将应用程序放回前台之前我无法启动任何其他媒体。我的应用程序播放音频,并允许在后台运行和流式传输。是否可以选择告诉Googlecast框架保持套接字打开?

Using the iOS Sender API Framework, when my application goes in the background, the SDK tears down all connections and I cannot launch any more media until the app is put back in the foreground. My app plays audio and is allowed to run and stream in the background. Is there an option to tell Googlecast framework to keep the sockets opened?

这是登录后台的日志:

信息:将辞职活动

信息:现在在后台

罚款: - [GCKCastSocket disconnect] disconnect

FINE: -[GCKCastSocket disconnect] disconnect

精细: - [GCKCastSocket doTeardownWithError:] doTeardownWithError

FINE: -[GCKCastSocket doTeardownWithError:] doTeardownWithError

精细: - [GCKCastSocket doTeardownWithError:]通知委托说套接字是已断开连接

FINE: -[GCKCastSocket doTeardownWithError:] notifying delegate that socket is disconnected

精细: - [GCKHeartbeatChannel didDisconnect]已断开连接 - 必要时停止心跳计时器

FINE: -[GCKHeartbeatChannel didDisconnect] disconnected - stopping heartbeat timer if necessary

精细: - [GCKCastSocket socketDidDisconnect:withError:] socketDidDisconnect:withError:(null)

FINE: -[GCKCastSocket socketDidDisconnect:withError:] socketDidDisconnect:withError: "(null)"

然后当应用程序恢复时:
INFO:进入前台

Then when the app resumes: INFO: Going into foreground

FINE: - [GCKCastSocket doTeardownWithError:] doTeardownWithError

FINE: -[GCKCastSocket doTeardownWithError:] doTeardownWithError

FINE: - [GCKCastSocket doTeardownWithError:]通知委托,套接字已断开连接

FINE: -[GCKCastSocket doTeardownWithError:] notifying delegate that socket is disconnected

精细: - [GCKC astSocket connectToHost:port:withTimeout:]在端口8009l上连接到192.168.1.4...

FINE: -[GCKCastSocket connectToHost:port:withTimeout:] Connecting to "192.168.1.4" on port 8009l...

信息:变为活动

精细: - [GCKCastSocket socket:didConnectToHost:port:] socketDidConnect:

FINE: -[GCKCastSocket socket:didConnectToHost:port:] socketDidConnect:

精细: - [GCKCastSocket socketDidSecure:] socketDidSecure:

FINE: -[GCKCastSocket socketDidSecure:] socketDidSecure:

精细: - [GCKCastSocket套接字:didReadData:withTag:]前缀读取,预期消息长度= 1307

FINE: -[GCKCastSocket socket:didReadData:withTag:] prefix read, expected message length=1307

精细: - [GCKDeviceAuthChannel didReceiveBinaryMessage:]正版Google设备didDeviceAuthenticated = YES

FINE: -[GCKDeviceAuthChannel didReceiveBinaryMessage:] Genuine Google device didDeviceAuthenticated=YES

精细: - [GCKDeviceManager deviceAuthChannelDidAuthenticate:]正宗设备,连接接收器频道

FINE: -[GCKDeviceManager deviceAuthChannelDidAuthenticate:] Authentic device, connecting receiver channel

精细: - [GCKCastSocket套接字:didReadData:withTag:]前缀读取,预期消息长度= 474

FINE: -[GCKCastSocket socket:didReadData:withTag:] prefix read, expected message length=474

精细: - [GCKDeviceManager receiverControlChannel:didReceiveStatusForApplication:]应用程序到join(CC1AD845)可用

FINE: -[GCKDeviceManager receiverControlChannel:didReceiveStatusForApplication:] Application to join (CC1AD845) is available

FINE: - [GCKDeviceManager connectAndNotifyDidConnectToApplication:launc hedApplication:]连接到应用程序< 0x1467c8f0:GCKApplicationMetadata>默认媒体接收器(CC1AD845),传输ID web-11

FINE: -[GCKDeviceManager connectAndNotifyDidConnectToApplication:launchedApplication:] Connected to application <0x1467c8f0:GCKApplicationMetadata> Default Media Receiver (CC1AD845), transport ID web-11

精细: - [GCKCastSocket socket:didReadData:withTag: ]前缀读取,预期消息长度= 135

FINE: -[GCKCastSocket socket:didReadData:withTag:] prefix read, expected message length=135

罚款: - 收到[GCKMediaControlChannel didReceiveTextMessage:]消息:{type:MEDIA_STATUS,status:[] ,requestId:6}

FINE: -[GCKMediaControlChannel didReceiveTextMessage:] message received: {"type":"MEDIA_STATUS","status":[],"requestId":6}

推荐答案

使用iOS Sender API 2.0版, GCKCastSocket 在收到 UIApplicationDidEnterBackgroundNotification 时关闭,这不是可以配置的东西。

With the version 2.0 of the iOS Sender API, the GCKCastSocket is closed upon receiving a UIApplicationDidEnterBackgroundNotification and this is not something that can be configured.

这意味着:


  • 当应用在后台时,没有新媒体可以从应用推送到chromecast

  • 无法实现锁定屏幕控制

替代方案(仅限自定义接收方):

Alternatives (custom receiver only):


  • 发送要播放的媒体列表到接收者

  • 直接从接收器从云端获取新媒体

参见< a href =https://stackoverflow.com/questions/22011821/chromecast-background-video-playback-support-ios>这个问题或 this one for more details。

See also this question or this one for more details.

这篇关于谷歌Chromecast SDK TearDown在后台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆