diff --git a/lib/src/rtc_peerconnection_impl.dart b/lib/src/rtc_peerconnection_impl.dart index 8778146..8afcb26 100644 --- a/lib/src/rtc_peerconnection_impl.dart +++ b/lib/src/rtc_peerconnection_impl.dart @@ -227,18 +227,9 @@ class RTCPeerConnectionWeb extends RTCPeerConnection { } @override - Future addCandidate(RTCIceCandidate candidate) async { - try { - Completer completer = Completer(); - var success = js.allowInterop(() => completer.complete()); - var failure = js.allowInterop((e) => completer.completeError(e)); - jsutil.callMethod( - _jsPc, 'addIceCandidate', [_iceToJs(candidate), success, failure]); - - return completer.future; - } catch (e) { - print(e.toString()); - } + Future addCandidate(RTCIceCandidate candidate) { + return jsutil.promiseToFuture( + jsutil.callMethod(_jsPc, 'addIceCandidate', [_iceToJs(candidate)])); } @override