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

Fix URL error failure mode #1556

Open
gisborne opened this issue Mar 30, 2024 · 2 comments
Open

Fix URL error failure mode #1556

gisborne opened this issue Mar 30, 2024 · 2 comments

Comments

@gisborne
Copy link

gisborne commented Mar 30, 2024

Describe the bug

Seeing this error when trying to create a channel:

MissingPluginException(No implementation found for method listen on channel)

To Reproduce

Create new Flutter app. Delete chrome and variables from default app.

Replace build method with:

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: const Text("WebRTC Demo"),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            ElevatedButton(
              onPressed: () async {
                _peerConnection ??= await createPeerConnection({
                  "iceServers": [
                    {"url": "stun.l.google.com:19302"},
                    {"url": "stun1.l.google.com:19302"},
                    {"url": "stun2.l.google.com:19302"},
                    {"url": "stun3.l.google.com:19302"},
                    {"url": "stun4.l.google.com:19302"},
                  ],
                });
                _peerConnection!.onIceCandidate = (candidate) {
                  if (_peerConnection!.iceConnectionState ==
                      RTCIceConnectionState.RTCIceConnectionStateCompleted) {
                    print("Sending ${candidate.toMap()}");
                  }
                };
              },
              child: const Text("Start WebRTC"),
            ),
            ElevatedButton(
              onPressed: () {
                _peerConnection?.close();
                _peerConnection = null;
              },
              child: const Text("Stop WebRTC"),
            ),
          ],
        ),
      ),
    );
  }

Run app in MacOS and click Start WebRTC button. Observe error in console.

Expected behavior

Should create peer connection and print "Sending" message to console.

Platform information
Dart 3.3.3

  • Flutter version:
    Flutter 3.29.5

  • Plugin version:

  • OS:
    MacOS

  • OS version:
    M1 MacOS 14.2.1.

@gisborne
Copy link
Author

gisborne commented Mar 30, 2024

Commenting out the ice servers removes the problem.

Also occurs in iOS Simulator 17.4 iPhone SE (3rd generation)

@gisborne
Copy link
Author

Found the answer. I had this for the iceServers argument:

"iceServers": [
  {'url': 'stun.l.google.com:19302'},
…

This should be:

"iceServers": [
  {'url': 'stun:stun.l.google.com:19302'},

This is an abominable failure mode and should be fixed.

@gisborne gisborne changed the title MacOS: "MissingPluginException(No implementation found for method listen on channel)" Fix URL error failure mode Mar 31, 2024
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