Skip to content

Commit

Permalink
Merge pull request #45 from flutter-webrtc/release/1.5.0
Browse files Browse the repository at this point in the history
fix: MediaStreamTrack.getSettings.
  • Loading branch information
cloudwebrtc authored Jul 12, 2024
2 parents 937f43c + 1047d10 commit 7c11f62
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Changelog

--------------------------------------------
[1.4.7] - 2024-07-12

* fix: MediaStreamTrack.getSettings.

[1.4.6+hotfix.2] - 2024-06-07

[1.4.6+hotfix.1] - 2024-06-07

* Wider version dependencies for js/http.
Expand Down
26 changes: 25 additions & 1 deletion lib/src/media_stream_track_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import 'dart:typed_data';
import 'package:web/web.dart' as web;
import 'package:webrtc_interface/webrtc_interface.dart';

import 'utils.dart';

class MediaStreamTrackWeb extends MediaStreamTrack {
MediaStreamTrackWeb(this.jsTrack) {
jsTrack.addEventListener('ended', ((event) => onEnded?.call()).toJS);
Expand Down Expand Up @@ -64,7 +66,29 @@ class MediaStreamTrackWeb extends MediaStreamTrack {

@override
Map<String, dynamic> getSettings() {
return jsTrack.getSettings() as Map<String, dynamic>;
var settings = jsTrack.getSettings();
var _converted = <String, dynamic>{};
if (kind == 'audio') {
_converted['sampleRate'] = settings.sampleRate;
_converted['sampleSize'] = settings.sampleSize;
_converted['echoCancellation'] = settings.echoCancellation;
_converted['autoGainControl'] = settings.autoGainControl;
_converted['noiseSuppression'] = settings.noiseSuppression;
_converted['latency'] = settings.latency;
_converted['channelCount'] = settings.channelCount;
} else {
_converted['width'] = settings.width;
_converted['height'] = settings.height;
_converted['aspectRatio'] = settings.aspectRatio;
_converted['frameRate'] = settings.frameRate;
if (isMobile) {
_converted['facingMode'] = settings.facingMode;
}
_converted['resizeMode'] = settings.resizeMode;
}
_converted['deviceId'] = settings.deviceId;
_converted['groupId'] = settings.groupId;
return _converted;
}

@override
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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.4.6+hotfix.1
version: 1.4.7
homepage: https://github.com/flutter-webrtc/dart-webrtc

environment:
Expand Down

0 comments on commit 7c11f62

Please sign in to comment.