chromecast-scanner icon indicating copy to clipboard operation
chromecast-scanner copied to clipboard

Can i get the chromecast friendly name?

Open ScolDev opened this issue 7 years ago • 3 comments

Hi!

Is possible to get the friendly chromecast name? The service object looks like:

{ 
  name: '9098057d-0d67-523d-56df-0b048c5f01e3.local',
  type: 'A',
  class: 32769,
  ttl: 120,
  data: '192.168.1.XXX'
 }

But i want to get the name that appears in apps like Youtube, in my case is 'CaneloChromecast'. How can i get this?

Thanks!

ScolDev avatar Jul 28 '18 23:07 ScolDev

Try running this:

var scanner = require('chromecast-scanner');
var txt = require('dns-txt')();

scanner((err, service, response) => {
  var info = response.additionals.find(entry => entry.type === 'TXT');
  var name = txt.decode(info.data).fn;
  console.log(name);
});

Rafostar avatar Feb 26 '19 21:02 Rafostar

@xat - I'd be happy to include a PR for this library so that the friendly name can be scanned, as well.

Right now, opts.name matches the name of the A record. I propose we add opts.friendlyName that matches the fn service key entry in the TXT record as suggested by @Rafostar above. This will be the user-defined name for the Chromecast that users probably prefer.

bminer avatar Nov 01 '22 04:11 bminer

My goal here is that castnow could be modified to prefer scanning by the friendly name. Thoughts?

bminer avatar Nov 01 '22 04:11 bminer