From 2ba5bbc3b82768ffce89c99abf938863d92a447a Mon Sep 17 00:00:00 2001 From: cloudwebrtc Date: Sun, 23 Feb 2025 09:47:03 +0800 Subject: [PATCH 1/4] release: 1.5.2+hotfix.1. --- CHANGELOG.md | 4 ++++ lib/src/rtc_peerconnection_impl.dart | 10 +++++----- pubspec.yaml | 3 +-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index caf5c73..fb43052 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ -------------------------------------------- +[1.5.2+hotfix.1] - 2025-02-23. + +* remove platform_detect. + [1.5.2] - 2025-02-23. * fix stats for web. diff --git a/lib/src/rtc_peerconnection_impl.dart b/lib/src/rtc_peerconnection_impl.dart index 8d171a0..458d007 100644 --- a/lib/src/rtc_peerconnection_impl.dart +++ b/lib/src/rtc_peerconnection_impl.dart @@ -4,7 +4,6 @@ import 'dart:js_interop'; import 'dart:js_interop_unsafe'; import 'package:dart_webrtc/dart_webrtc.dart'; -import 'package:platform_detect/platform_detect.dart'; import 'package:web/web.dart' as web; import 'media_stream_track_impl.dart'; @@ -44,7 +43,7 @@ class RTCPeerConnectionWeb extends RTCPeerConnection { iceConnectionStateForString(_jsPc.iceConnectionState); onIceConnectionState?.call(_iceConnectionState!); - if (browser.isFirefox) { + if (web.Device.isFirefox) { switch (_iceConnectionState!) { case RTCIceConnectionState.RTCIceConnectionStateNew: _connectionState = RTCPeerConnectionState.RTCPeerConnectionStateNew; @@ -93,7 +92,7 @@ class RTCPeerConnectionWeb extends RTCPeerConnection { _jsPc.addEventListener('signalingstatechange', onSignalingStateChange.toJS); - if (!browser.isFirefox) { + if (!web.Device.isFirefox) { final void Function(JSAny) onConnectionStateChange = (_) { _connectionState = peerConnectionStateForString(_jsPc.connectionState); onConnectionState?.call(_connectionState!); @@ -159,7 +158,7 @@ class RTCPeerConnectionWeb extends RTCPeerConnection { @override Future getIceConnectionState() async { _iceConnectionState = iceConnectionStateForString(_jsPc.iceConnectionState); - if (browser.isFirefox) { + if (web.Device.isFirefox) { switch (_iceConnectionState!) { case RTCIceConnectionState.RTCIceConnectionStateNew: _connectionState = RTCPeerConnectionState.RTCPeerConnectionStateNew; @@ -196,7 +195,8 @@ class RTCPeerConnectionWeb extends RTCPeerConnection { @override Future getConnectionState() async { - if (browser.isFirefox) { + /// platform is Firefox + if (web.Device.isFirefox) { await getIceConnectionState(); } else { _connectionState = peerConnectionStateForString(_jsPc.connectionState); diff --git a/pubspec.yaml b/pubspec.yaml index 94364ce..5c762d1 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ 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.5.2 +version: 1.5.2+hotfix.1 homepage: https://github.com/flutter-webrtc/dart-webrtc environment: @@ -11,7 +11,6 @@ dependencies: js: ">0.6.0 <0.8.0" logging: ^1.1.0 meta: ^1.8.0 - platform_detect: ^2.1.5 synchronized: ^3.0.0+3 web: ^1.0.0 webrtc_interface: ^1.2.1 From ddddf4df82ae4c33b1318f481035d3e629f47e22 Mon Sep 17 00:00:00 2001 From: Rene Floor Date: Wed, 19 Mar 2025 09:25:10 +0100 Subject: [PATCH 2/4] Fix jsify on function --- lib/src/rtc_peerconnection_impl.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/src/rtc_peerconnection_impl.dart b/lib/src/rtc_peerconnection_impl.dart index 458d007..f0c8b99 100644 --- a/lib/src/rtc_peerconnection_impl.dart +++ b/lib/src/rtc_peerconnection_impl.dart @@ -314,7 +314,7 @@ class RTCPeerConnectionWeb extends RTCPeerConnection { @override Future> getStats([MediaStreamTrack? track]) async { - var stats; + web.RTCStatsReport stats; if (track != null) { var jsTrack = (track as MediaStreamTrackWeb).jsTrack; stats = await _jsPc.getStats(jsTrack).toDart; @@ -335,7 +335,7 @@ class RTCPeerConnectionWeb extends RTCPeerConnection { value.getProperty('type'.toJS).toDart, value.getProperty('timestamp'.toJS).toDartDouble, stats)); - }.jsify() + }.toJS, ]); return report; } From 5c489db07c6edaf379b3961c6664a42837c8ae45 Mon Sep 17 00:00:00 2001 From: Rene Floor Date: Wed, 19 Mar 2025 11:01:03 +0100 Subject: [PATCH 3/4] Use toJS in RTCRtp receiver and sender --- lib/src/rtc_rtp_receiver_impl.dart | 2 +- lib/src/rtc_rtp_sender_impl.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/src/rtc_rtp_receiver_impl.dart b/lib/src/rtc_rtp_receiver_impl.dart index b017b6e..fd56929 100644 --- a/lib/src/rtc_rtp_receiver_impl.dart +++ b/lib/src/rtc_rtp_receiver_impl.dart @@ -30,7 +30,7 @@ class RTCRtpReceiverWeb extends RTCRtpReceiver { value.getProperty('type'.toJS).toDart, value.getProperty('timestamp'.toJS).toDartDouble, stats)); - }.jsify() + }.toJS, ]); return report; } diff --git a/lib/src/rtc_rtp_sender_impl.dart b/lib/src/rtc_rtp_sender_impl.dart index 38b40c2..c62aaaf 100644 --- a/lib/src/rtc_rtp_sender_impl.dart +++ b/lib/src/rtc_rtp_sender_impl.dart @@ -98,7 +98,7 @@ class RTCRtpSenderWeb extends RTCRtpSender { value.getProperty('type'.toJS).toDart, value.getProperty('timestamp'.toJS).toDartDouble, stats)); - }.jsify() + }.toJS, ]); return report; } From 3a12556b492f6620479adbf03e1189e00f97796c Mon Sep 17 00:00:00 2001 From: cloudwebrtc Date: Mon, 24 Mar 2025 11:36:18 +0800 Subject: [PATCH 4/4] release: 1.5.3. --- CHANGELOG.md | 4 ++++ lib/src/rtc_data_channel_impl.dart | 5 +++++ pubspec.yaml | 4 ++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fb43052..e02c3c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ -------------------------------------------- +[1.5.3] - 2025-03-24 + +* add getBufferedAmount for DC. + [1.5.2+hotfix.1] - 2025-02-23. * remove platform_detect. diff --git a/lib/src/rtc_data_channel_impl.dart b/lib/src/rtc_data_channel_impl.dart index eb6010b..f41be4e 100644 --- a/lib/src/rtc_data_channel_impl.dart +++ b/lib/src/rtc_data_channel_impl.dart @@ -48,6 +48,11 @@ class RTCDataChannelWeb extends RTCDataChannel { @override int? get bufferedAmount => _jsDc.bufferedAmount; + @override + Future getBufferedAmount() async { + return _jsDc.bufferedAmount; + } + @override set bufferedAmountLowThreshold(int? bufferedAmountLowThreshold) { _jsDc.bufferedAmountLowThreshold = bufferedAmountLowThreshold ?? 0; diff --git a/pubspec.yaml b/pubspec.yaml index 5c762d1..910244b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ 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.5.2+hotfix.1 +version: 1.5.3 homepage: https://github.com/flutter-webrtc/dart-webrtc environment: @@ -13,7 +13,7 @@ dependencies: meta: ^1.8.0 synchronized: ^3.0.0+3 web: ^1.0.0 - webrtc_interface: ^1.2.1 + webrtc_interface: ^1.2.2+hotfix.1 dev_dependencies: build_runner: ^2.3.3