是否有可能检测到当前WiFi网络上是否有Chromecast设备。我已经看到有一个Cast SDK,但是我找不到任何关于搜索设备的东西。以前从未使用过这个SDK,可能我忽略了它。
发布于 2014-05-04 08:38:54
您可以在本地网络中使用SSDP (简单服务发现协议),其ST (服务类型)为:
urn:dial-multiscreen-org:service:dial:1
您的SSDP查询应该如下所示:
M-SEARCH * HTTP/1.1\r\n
Host: 239.255.255.250:1900\r\n
MAN: "ssdp:discover"\r\n
MX: 3\r\n
ST: urn:dial-multiscreen-org:service:dial:1\r\n\r\n
您将得到支持这些服务类型的所有设备(IP和端口)的列表(就像Chromecast那样)。然后,您可以从这个IP:8008中提取一个xml文件,以检查它是否真的是Chromecast设备:
http://IP:8008/ssdp/device-desc.xml
答复如下:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<specVersion>
<major>1</major>
<minor>0</minor>
</specVersion>
<URLBase>http://192.168.0.0:8008</URLBase>
<device>
<deviceType>urn:dial-multiscreen-org:device:dial:1</deviceType>
<friendlyName>Chromecast</friendlyName>
<manufacturer>Google Inc.</manufacturer>
<modelName>Eureka Dongle</modelName>
<UDN>uuid:3c7f2a1e-dbd2-f94d-b456-816555a9d1f9</UDN>
<iconList>
<icon>
<mimetype>image/png</mimetype>
<width>98</width>
<height>55</height>
<depth>32</depth>
<url>/setup/icon.png</url>
</icon>
</iconList>
<serviceList>
<service>
<serviceType>urn:dial-multiscreen-org:service:dial:1</serviceType>
<serviceId>urn:dial-multiscreen-org:serviceId:dial</serviceId>
<controlURL>/ssdp/notfound</controlURL>
<eventSubURL>/ssdp/notfound</eventSubURL>
<SCPDURL>/ssdp/notfound</SCPDURL>
</service>
</serviceList>
</device>
</root>
有关它的更多信息,请在这里:http://wolfpaulus.com/jounal/mac/chromecasting/
如果您想将内容流到您的Chromecast,您可以通过调用:
http://IP:8008/apps/ChromeCast
https://stackoverflow.com/questions/23220957
复制相似问题