Skip to content

Commit

Permalink
fix: Fix wrong override when options is not null when LocalTrack.create.
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudwebrtc committed Jun 21, 2023
1 parent c02fad6 commit dc1d8fb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/src/track/local/audio.dart
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class LocalAudioTrack extends LocalTrack
static Future<LocalAudioTrack> create([
AudioCaptureOptions? options,
]) async {
options = const AudioCaptureOptions();
options ??= const AudioCaptureOptions();
final stream = await LocalTrack.createStream(options);

return LocalAudioTrack(
Expand Down
9 changes: 6 additions & 3 deletions lib/src/track/local/video.dart
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class LocalVideoTrack extends LocalTrack with VideoTrack {
static Future<LocalVideoTrack> createCameraTrack([
CameraCaptureOptions? options,
]) async {
options = const CameraCaptureOptions();
options ??= const CameraCaptureOptions();

final stream = await LocalTrack.createStream(options);
return LocalVideoTrack._(
Expand Down Expand Up @@ -165,8 +165,11 @@ class LocalVideoTrack extends LocalTrack with VideoTrack {
static Future<List<LocalTrack>> createScreenShareTracksWithAudio([
ScreenShareCaptureOptions? options,
]) async {
options = const ScreenShareCaptureOptions(captureScreenAudio: true);

if (options == null) {
options = const ScreenShareCaptureOptions(captureScreenAudio: true);
} else {
options = options.copyWith(captureScreenAudio: true);
}
final stream = await LocalTrack.createStream(options);

List<LocalTrack> tracks = [
Expand Down

2 comments on commit dc1d8fb

@furkanKotic
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cloudwebrtc Does this error mean that even if we give the defaultCameraCaptureOptions parameter it is ignored?

@cloudwebrtc
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.