我可以为iOS CastSDK 4.5.0创建自定义设备选择器吗 [英] Can I create Custom Device Picker for iOS CastSDK 4.5.0

查看:62
本文介绍了我可以为iOS CastSDK 4.5.0创建自定义设备选择器吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Swift Google Cast SDK 4.5.0中,我可以创建自定义设备选择器吗?

In Swift Google Cast SDK 4.5.0 can I create Custom Device picker ?

以前,在使用'3.4.0'时,我能够使用GCKDeviceScanner做到这一点.到目前为止,对于4.5.0,设备扫描是自动完成的.因此,我想知道是否仍然可以创建自定义设备选择器,因为我的应用程序设计有所不同.

Previously while using '3.4.0' I was able to do it using GCKDeviceScanner. As for now for 4.5.0 device scanning is done automatically. So I want to know if I still can create a custom device picker cause my application design is different.

更具体地说,我要自定义的屏幕附有屏幕截图.

To be more specific Screenshot is attached of the screen I want to customize.

我浏览了所有文档,但找不到任何东西

i have gone through all the documentation but couldn't find anything

感谢您的帮助.

推荐答案

所以最后我找到了一个解决方案.我没有使用 GCKCastButton ,而是使用了自定义的Cast按钮,或者我们只需要为 GCKCastButton 提供自定义的 selector .为了发现设备并在您的自定义视图中显示它们,我们可以像这样使用 GCKDiscoverManager

So Finally I found a solution. Instead of using GCKCastButton I used custom Cast Button or we just need to give custom selector to GCKCastButton. And for Discovering Devices and showing those in your custom view, We can use GCKDiscoverManager like this

let gckCastOptions = GCKCastOptions(receiverApplicationID: kGoogleCastAppReceiverId)
    GCKCastContext.setSharedInstanceWithOptions(gckCastOptions)
    GCKLogger.sharedInstance().delegate = self

    self.discoveryManager = GCKCastContext.sharedInstance().discoveryManager
    self.discoveryManager!.addListener(self)
    self.discoveryManager!.passiveScan = true
    self.discoveryManager!.startDiscovery()

然后是Listener方法

And then the Listener method

func didStartDiscoveryForDeviceCategory(deviceCategory: String) {
    print("GCKDiscoveryManagerListener: \(deviceCategory)")

    print("FOUND: \(self.discoveryManager!.hasDiscoveredDevices)")
}

我希望这可以帮助那些努力寻找解决我所遇到问题的方法的人.

I hope this can help someone struggling to find solution to the problem I faced.

参考: https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_discovery_manager

这篇关于我可以为iOS CastSDK 4.5.0创建自定义设备选择器吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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