diff --git a/CHANGELOG.md b/CHANGELOG.md index caf5c73..e02c3c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ -------------------------------------------- +[1.5.3] - 2025-03-24 + +* add getBufferedAmount for DC. + +[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_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/lib/src/rtc_peerconnection_impl.dart b/lib/src/rtc_peerconnection_impl.dart index 8d171a0..f0c8b99 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); @@ -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; } 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; } diff --git a/pubspec.yaml b/pubspec.yaml index 94364ce..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 +version: 1.5.3 homepage: https://github.com/flutter-webrtc/dart-webrtc environment: @@ -11,10 +11,9 @@ 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 + webrtc_interface: ^1.2.2+hotfix.1 dev_dependencies: build_runner: ^2.3.3