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

Cant find any device in network #52

Open
renanmgs opened this issue Jan 18, 2022 · 1 comment
Open

Cant find any device in network #52

renanmgs opened this issue Jan 18, 2022 · 1 comment

Comments

@renanmgs
Copy link

The funcion find_chromecast.find_chromecasts() is not able to return any device in network, and trow an error :
"Dart Socket ERROR: ../../third_party/dart/runtime/bin/socket_android.cc:147: reusePort not supported for Android."

The error can be fixed adding rawDatagramSocketFactory to MDnsClient() but it stills not returning any device.

My code:

 @override
  void initState() {
    findCastingDevices();

    super.initState();
  }

Future<void> findCastingDevices() async {
    // search!
    print('Looking for ChromeCast devices...');
    devices = (await find_chromecast.find_chromecasts()).cast<find_chromecast.CastDevice>();
    if (devices.length == 0) {
      print('No devices found!');
      Future.delayed(Duration(seconds: 45), () {
        findCastingDevices();
      });
      return;
    }

    print("Found ${devices.length} devices:");
    for (int i = 0; i < devices.length; i++) {
      int index = i + 1;
      find_chromecast.CastDevice device = devices[i];
      print("$index: ${device.name}");
    }
    setState(() {});
  }
@renanmgs
Copy link
Author

@terrabythia

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

No branches or pull requests

1 participant