mafintosh / chromecasts

Query your local network for Chromecasts and have them play media
MIT License
1.45k stars 68 forks source link

Different Google Cast devices #26

Open romaincointepas opened 7 years ago

romaincointepas commented 7 years ago

Right now it seems that this library will show all Google Cast devices that have device.manufacturer = "Google Inc.".

As far as I know, the only way to know at discovery time if a Google Cast-compatible device (including Google's own devices) is audio-only is by matching the device.manufacturer and/or device. modelName to a list (I've pasted below the SSDP response for Google Home that is audio-only).

I'm also wondering if all Google Cast compatible devices (ex: NVIDIA Shield, Sony Bravia, etc.) will answer with device.manufacturer = "Google Inc." (I'm assuming they don't).

It would be great if this library could also returns device.modelName as a property, and potentially add an option to not filter Google Inc. as manufacturer and returns device.manufacturer as well so anyone with a more advanced use-case (and time on its hand) could offer a better experience.

Something that could be cool would be a property audioOnly that is true if we're sure it's an audio-only device, otherwise false (and a comprehensive list could be maintained in the lib, starting with the obvious Chromecast Audio and Google Home).

While I'm not sure I'm the right person for a PR, I'm definitely open to report back on any manufacturer/modelName I encounter in the wild. Maybe the folks at webtorrent-desktop knows more about this (@feross, @dcposch).

I've also find this if it helps:


{
   "$":{
      "xmlns":"urn:schemas-upnp-org:device-1-0"
   },
   "specVersion":{
      "major":"1",
      "minor":"0"
   },
   "URLBase":"http://10.0.0.37:8008",
   "device":{
      "deviceType":"urn:dial-multiscreen-org:device:dial:1",
      "friendlyName":"Living Room",
      "manufacturer":"Google Inc.",
      "modelName":"Google Home",
      "UDN":"uuid:fee5c0d9-7475-b74a-1a14-xxx",
      "iconList":{
         "icon":{
            "mimetype":"image/png",
            "width":"98",
            "height":"55",
            "depth":"32",
            "url":"/setup/icon.png"
         }
      },
      "serviceList":{
         "service":{
            "serviceType":"urn:dial-multiscreen-org:service:dial:1",
            "serviceId":"urn:dial-multiscreen-org:serviceId:dial",
            "controlURL":"/ssdp/notfound",
            "eventSubURL":"/ssdp/notfound"
         }
      }
   }
}
feross commented 7 years ago

I think that this idea makes a lot of sense.

I have a Chromecast Audio that I can test the audioOnly feature on, if you (or someone else) wants to send a PR.

mafintosh commented 7 years ago

:+1: