Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
RaghuMudem opened this issue May 4, 2023 · 6 comments
Assignees
Labels
question Further information is requested

Comments

@RaghuMudem
Copy link

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

  • bonsoir: ^2.0.0
  • Flutter 3.7.6
  • Dart 2.19.3
@RaghuMudem RaghuMudem added the bug Something isn't working label May 4, 2023
@Skyost Skyost added question Further information is requested and removed bug Something isn't working labels May 5, 2023
@Skyost
Copy link
Owner

Skyost commented May 5, 2023

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
Copy link
Author

RaghuMudem commented May 5, 2023

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
Copy link
Owner

Skyost commented May 6, 2023

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 :

  • If it's not 8009, then the cast type is set to group.
  • If it's 8009, then it looks to the model type (md attribute) and refers to this table to know whether the cast type is cast, audio or group.

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
Copy link
Author

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
Copy link
Owner

Skyost commented May 8, 2023

No problem 👍

@Skyost Skyost closed this as completed Jun 5, 2023
@dgilperez
Copy link

@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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants