Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix iOSBroadcastExtension always false after copyWith invoked #380

Merged
merged 2 commits into from
Oct 9, 2023
Merged

Fix iOSBroadcastExtension always false after copyWith invoked #380

merged 2 commits into from
Oct 9, 2023

Conversation

kNoAPP
Copy link
Contributor

@kNoAPP kNoAPP commented Oct 8, 2023

Expected
When I pass true to useiOSBroadcastExtension, the screen-share video track should invoke getDisplayMedia with constraints containing deviceId set to broadcast.

Actual
When I pass true to useiOSBroadcastExtension, the screen-share video instead leaves constraint deviceId unset because a prior call to ScreenShareCaptureOptions#copyWith always sets useiOSBroadcastExtension to the default value of false.

  /// Creates a LocalTracks(audio/video) from the display.
  ///
  /// The current API is mainly used to capture audio when chrome captures tab,
  /// but in the future it can also be used for flutter native to open audio
  /// capture device when capturing screen
  static Future<List<LocalTrack>> createScreenShareTracksWithAudio([
    ScreenShareCaptureOptions? options,
  ]) async {
    if (options == null) {
      options = const ScreenShareCaptureOptions(captureScreenAudio: true);
    } else {
      options = options.copyWith(captureScreenAudio: true); // <-- This line produces the bug
    }

[...]

Fix
Added support to ScreenShareCaptureOptions#copyWith to preserve or overwrite the value of useiOSBroadcastExtension.

Copy link
Contributor

@cloudwebrtc cloudwebrtc left a comment

Choose a reason for hiding this comment

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

lgtm

@cloudwebrtc cloudwebrtc merged commit 93c1758 into livekit:main Oct 9, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants