Skyost / Bonsoir

A Zeroconf library that allows you to discover network services and to broadcast your own. Based on Apple Bonjour and Android NSD.
http://bonsoir.skyost.eu/
Other
100 stars 43 forks source link

It is not possible to display only the video supported devices in discovery #49

Closed RaghuMudem closed 1 year ago

RaghuMudem commented 1 year ago

Question: In my Flutter application, I am using Bonsoir 2.0.0 to fetch the available devices. I use service type as _googlecast._tcp. This displays the available devices which are running under the same network. The problem is, it displays both the video and audio supported devices. But I wanted only the video supported devices. How to filter only the video devices?

The listed audio devices service info has shown below. Which is same a video device service info. So it became hard to filter audio devices and list only video devices.

{
   "service.name":"Google-Nest-Mini-f085fd9042490e01a04233c8bf333778",
   "service.type":"_googlecast._tcp",
   "service.port":8009,
   "service.attributes":{
      "bs":"FA8FCA78A8D0",
      "cd":"5810A9FF37B193370398E3678764CF83",
      "rs":"",
      "st":"0",
      "md":"Google Nest Mini",
      "fn":"Office speaker",
      "nf":"1",
      "ic":"/setup/icon.png",
      "id":"f085fd9042490e01a04233c8bf333778",
      "rm":"",
      "ca":"199172",
      "ve":"05"
   },
   "service.ip":"192.168.2.66"
}

Appreciate your response with suggestion.

Library version

Skyost commented 1 year ago

Well, it's a little bit off-topic. You may have to deal with the service name or with its attributes, but I can't tell you more since I've never been interested in this question. Sorry.

RaghuMudem commented 1 year ago

Hi Skyost,

Thank you for your quick response. I apologize for not conveying the importance of this topic clearly.

We are currently using the library and it works well to detect the devices. However, we also need to know the device capabilities, which is not possible with the service name and properties received from the library. The device name can be different if a third party has integrated the Chromecast in their device.

It could be helpful to have some way similar to android native castDevices methods mentioned here. https://developers.google.com/android/reference/com/google/android/gms/cast/CastDevice#public-boolean-hascapabilities-int%5B%5D-capabilities

Below are examples of a video device and an audio device:

Video Device

{
   "service.name":"DIW7022-8c80d0745f97d83edd8825c4e7ea3153",
   "service.type":"_googlecast._tcp",
   "service.port":8009,
   "service.attributes":{
      "bs":"FA8F6C9F4A95",
      "cd":"F57B7061D22CDF749CAFC29C0A5DBD8A",
      "rs":"",
      "st":"0",
      "md":"DIW7022",
      "fn":"Desk-A",
      "nf":"1",
      "ic":"/setup/icon.png",
      "id":"8c80d0745f97d83edd8825c4e7ea3153",
      "rm":"8EC0B0432CB99D7C",
      "ca":"266757",
      "ve":"05"
   },
   "service.ip":"192.168.*.*"
}

Audio Device

{
   "service.name":"Google-Nest-Mini-f085fd9042490e01a04233c8bf333778",
   "service.type":"_googlecast._tcp",
   "service.port":8009,
   "service.attributes":{
      "bs":"FA8FCA78A8D0",
      "cd":"5810A9FF37B193370398E3678764CF83",
      "rs":"",
      "st":"0",
      "md":"Google Nest Mini",
      "fn":"Office speaker",
      "nf":"1",
      "ic":"/setup/icon.png",
      "id":"f085fd9042490e01a04233c8bf333778",
      "rm":"",
      "ca":"199172",
      "ve":"05"
   },
   "service.ip":"192.168.*.**"
}

For security reason, I have changed the ip address in the above response. It would be appreciated if you could give us a clue on how to differentiate the video and audio capabilities of the devices.

Thank you.

Skyost commented 1 year ago

I see. But I maintain that's a little bit out of scope for this library : the goal here is only to discover the MDNS devices on your network.

To achieve what you want, I'm affraid that you may have to dive into the internal documentation of how Chromecasts work. I've did a little search for you : pychromecast (a Python library that helps interacting with Chromecast devices) first looks at the port :

Now ; the cast type cast supports both video and audio while the cast types audio and group only support audio.

Reference : https://github.com/home-assistant-libs/pychromecast/blob/master/pychromecast/discovery.py#L211.

RaghuMudem commented 1 year ago

Hi Skyost,

Thank you for your valuable response and for searching for the information I requested. I appreciate your effort and I will look into the reference you provided.

Thankyou.

Skyost commented 1 year ago

No problem 👍

dgilperez commented 5 months ago

@RaghuMudem hi! did you ever set this up working for chromecasts or other video-audio devices? If so, did you open source it or would you be open for that? I am looking for solutions in this line and Bonsoir looks a great option to me ...

(sorry for continuing the slight offtopic)