Closed ariporad closed 7 years ago
I believe you can request http://xxx.xxx.xxx.xxx:8008/ssdp/device-desc.xml
, where xxx.xxx.xxx.xxx
is the Chromecast IP. Not sure if there's an easier / quicker way.
@strabbit: Thanks so much... That seems to work for devices, but I can't figure out groups. So far, groups appear as a different device (same IP, different port), for example:
found device "Chromecast-Audio-be3e75f9990081c3d2e1e19dfde793f3" at 192.168.73.23:8009
found device "Google-Cast-Group-D953E9E64D954CEB959076DE7749EB39" at 192.168.73.23:42279
I tried going one port lower (ex. 42278
), and that didn't work.
Thanks again for all your help, the internet seems pretty scarce about this!
Okay -- I really don't understand mDNS... but I managed to get the names on my mac using dns-sd -Z _googlecast._tcp
... how that translates to something that can be used in node, I don't know... but it appears what you're looking for is the TXT
record.
I take that back... this is what you want:
var mdns = require('mdns');
var browser = mdns.createBrowser(mdns.tcp('googlecast'));
browser.on('serviceUp', function(service) {
console.log('found device "%s" at %s:%d', service.txtRecord.fn, service.addresses[0], service.port);
});
browser.start();
@strabbit: Thanks... I was just about to post that!
Would you consider adding that to the wiki, it could be really useful for newcomers.
This is right at the start of the readme code. If you think this is not enough, please reopen and comment.
@thibauts the README code currently doesn't refer to service.txtRecord.fn
, only to service.name
. On my machine these give two different results, only service.txtRecord.fn
gives the display name.
I changed the console.log
line in the README like so and it worked for me:
console.log('found device "%s" at %s:%d, "%s"', service.txtRecord.fn, service.addresses[0], service.port, service.name);
Thanks!!
Hi,
I'm trying to display the user friendly name of a chromecast, and I can't seem to figure out how to get it. Right now, I'm using MDNS to find the name, and I'm getting something like "Chromecast-Audio-9cd1691d91e3dd6a3b2edbe9b2f8aff4".
Any ideas on how to go about that? Thanks! (Sorry if I missed it!)