diff --git a/lib/src/track/local/audio.dart b/lib/src/track/local/audio.dart index 51809cce..dff72b82 100644 --- a/lib/src/track/local/audio.dart +++ b/lib/src/track/local/audio.dart @@ -99,7 +99,7 @@ class LocalAudioTrack extends LocalTrack static Future create([ AudioCaptureOptions? options, ]) async { - options = const AudioCaptureOptions(); + options ??= const AudioCaptureOptions(); final stream = await LocalTrack.createStream(options); return LocalAudioTrack( diff --git a/lib/src/track/local/video.dart b/lib/src/track/local/video.dart index 4078cbb5..78015cf2 100644 --- a/lib/src/track/local/video.dart +++ b/lib/src/track/local/video.dart @@ -128,7 +128,7 @@ class LocalVideoTrack extends LocalTrack with VideoTrack { static Future createCameraTrack([ CameraCaptureOptions? options, ]) async { - options = const CameraCaptureOptions(); + options ??= const CameraCaptureOptions(); final stream = await LocalTrack.createStream(options); return LocalVideoTrack._( @@ -165,8 +165,11 @@ class LocalVideoTrack extends LocalTrack with VideoTrack { static Future> 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 tracks = [