From 59c51229e1387b791fd6d2222bc666f10a3007bf Mon Sep 17 00:00:00 2001 From: cloudwebrtc Date: Mon, 7 Feb 2022 22:08:49 +0800 Subject: [PATCH] chore: bump version. --- CHANGELOG.md | 5 +++++ lib/src/rtc_peerconnection_impl.dart | 6 ++++++ pubspec.yaml | 4 ++-- web/p2p/signaling.dart | 16 ++++++++-------- web/test_peerconnection.dart | 2 -- 5 files changed, 21 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e2e4b1..9393f01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ # Changelog -------------------------------------------- +[1.0.3] - 2022-02-07 + +* Add restartIce. +* Bump version for webrtc-interface. + [1.0.2] - 2021-11-27 * Fix the type error of minified function in release mode. diff --git a/lib/src/rtc_peerconnection_impl.dart b/lib/src/rtc_peerconnection_impl.dart index 8778146..38e5973 100644 --- a/lib/src/rtc_peerconnection_impl.dart +++ b/lib/src/rtc_peerconnection_impl.dart @@ -282,6 +282,12 @@ class RTCPeerConnectionWeb extends RTCPeerConnection { return Future.value(RTCDataChannelWeb(jsDc)); } + @override + Future restartIce() { + jsutil.callMethod(_jsPc, 'restartIce', []); + return Future.value(); + } + @override Future close() async { _jsPc.close(); diff --git a/pubspec.yaml b/pubspec.yaml index 21a4935..7dcc3d8 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,13 +1,13 @@ name: dart_webrtc description: Use the dart/js library to re-wrap the webrtc js interface of the browser, to adapted common browsers. -version: 1.0.2 +version: 1.0.3 homepage: https://github.com/flutter-webrtc/dart-webrtc environment: sdk: '>=2.13.0 <3.0.0' dependencies: - webrtc_interface: ^1.0.1 + webrtc_interface: ^1.0.2 dev_dependencies: build_runner: ^1.10.0 diff --git a/web/p2p/signaling.dart b/web/p2p/signaling.dart index b2efecb..152df32 100644 --- a/web/p2p/signaling.dart +++ b/web/p2p/signaling.dart @@ -32,7 +32,7 @@ class Signaling { final JsonEncoder _encoder = JsonEncoder(); final String _selfId = randomNumeric(6); - late SimpleWebSocket _socket; + late SimpleWebSocket? _socket; var _sessionId; final _host; final _port = 8086; @@ -63,7 +63,7 @@ class Signaling { _peerConnections.forEach((key, pc) { pc.close(); }); - if (_socket != null) _socket.close(); + _socket?.close(); } void switchCamera() { @@ -228,25 +228,25 @@ class Signaling { } } - _socket.onOpen = () { + _socket?.onOpen = () { print('onOpen'); onStateChange?.call(SignalingState.ConnectionOpen); _send('new', {'name': 'dart_webrtc', 'id': _selfId, 'user_agent': 'broswer'}); }; - _socket.onMessage = (message) { + _socket?.onMessage = (message) { print('Received data: ' + message); var decoder = JsonDecoder(); onMessage.call(decoder.convert(message)); }; - _socket.onClose = (int code, String reason) { + _socket?.onClose = (int code, String reason) { print('Closed by server [$code => $reason]!'); onStateChange?.call(SignalingState.ConnectionClosed); }; - await _socket.connect(); + await _socket?.connect(); } Future createStream(media, user_screen) async { @@ -291,7 +291,7 @@ class Signaling { 'to': id, 'from': _selfId, 'candidate': { - 'sdpMLineIndex': candidate.sdpMlineIndex, + 'sdpMLineIndex': candidate.sdpMLineIndex, 'sdpMid': candidate.sdpMid, 'candidate': candidate.candidate, }, @@ -377,6 +377,6 @@ class Signaling { var request = {}; request['type'] = event; request['data'] = data; - _socket.send(_encoder.convert(request)); + _socket?.send(_encoder.convert(request)); } } diff --git a/web/test_peerconnection.dart b/web/test_peerconnection.dart index c680d2a..ebbc245 100644 --- a/web/test_peerconnection.dart +++ b/web/test_peerconnection.dart @@ -1,5 +1,3 @@ -import 'dart:html'; - import 'package:dart_webrtc/dart_webrtc.dart'; import 'package:test/test.dart';