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

WebRTC undefined getters on IOS and Android #29

Closed
brown62 opened this issue Jan 30, 2021 · 2 comments
Closed

WebRTC undefined getters on IOS and Android #29

brown62 opened this issue Jan 30, 2021 · 2 comments

Comments

@brown62
Copy link

brown62 commented Jan 30, 2021

I'm implementing WebRTC and what I have so far builds and runs as expected when I debug with Chrome but when I try to run my code on an Android or IOS emulator I get a few dozen of the following errors and the build fails.

lib/common/webRTC.dart:33:24: Error: Method not found: 'RtcPeerConnection'.
    myPeerConnection = RtcPeerConnection(rtcIceServers);

lib/screens/calling.dart:29:30: Error: The getter 'candidate' isn't defined for the class 'RtcPeerConnectionIceEvent'.
- 'RtcPeerConnectionIceEvent' is from 'package:universal_html/src/html_with_internals.dart' ('/usr/local/Caskroom/flutter/1.22.5/flutter/.pub-cache/hosted/pub.dartlang.org/universal_html-1.2.4/lib/src/html_with_internals.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'candidate'.

    'candidate': event.candidate.candidate,
                              
lib/screens/calling.dart:34:27: Error: The getter 'onTrack' isn't defined for the class 'RtcPeerConnection'.
- 'RtcPeerConnection' is from 'package:universal_html/src/html_with_internals.dart' ('/usr/local/Caskroom/flutter/1.22.5/flutter/.pub-cache/hosted/pub.dartlang.org/universal_html-1.2.4/lib/src/html_with_internals.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'onTrack'.
 
     peer.myPeerConnection.onTrack.listen((event) {
                                                    

I've tested a bunch of combinations but currently this is my environment:

Flutter (Channel master, 1.26.0-18.0.pre.90, on macOS 11.1 20C69 darwin-x64, locale en-US)
Platform android-30, build-tools 30.0.3
Xcode 12.4, Build version 12D4e
import 'package:universal_html/html.dart';

dependencies:
  flutter:
    sdk: flutter
  provider: ^4.3.2
  universal_html: ^1.2.4

and a snippet where I'm getting the errors:


peer.myPeerConnection.onIceCandidate.listen((event) {
      print('ice');
      if (event.candidate != null) {
        socket.send(jsonEncode({
          'type': 'candidate',
          'target': caller ?? contact,
          'candidate': event.candidate.candidate,
        }));
      }
    });

peer.myPeerConnection.onTrack.listen((event) {
      print('track');
    });

Any ideas on how to get it working on mobile?

Thanks!

@terrier989
Copy link
Member

Thanks for the report! A pull request that adds the missing classes would be accepted.

terrier989 added a commit that referenced this issue Mar 15, 2021
@terrier989
Copy link
Member

Fixed in v2.0.3.

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

2 participants