livekit / client-sdk-swift

LiveKit Swift Client SDK. Easily build live audio or video experiences on iOS, macOS, tvOS, and visionOS.
https://livekit.io
Apache License 2.0
198 stars 97 forks source link

support app sharing in screen capture #276

Closed creativecbr closed 10 months ago

creativecbr commented 10 months ago

Hello everyone, my issue revolves around the inability to share app content during screen sharing. I attempted to use MacOSScreenCapturer.sources with the parameter includeCurrentApplication set to true, but unfortunately, it did not yield the desired outcome.

In order to address this issue, I made the following pull request (PR) changes. In these changes, I introduced the includeCurrentApplication parameter to ScreenShareCaptureOptions and utilized it to exclude the app filter in MacOSScreenCapturer. This modification enables the retrieval of sources as demonstrated in the following code snippet:

_ = MacOSScreenCapturer.mainDisplaySource().then { displaySource in
    Task {
        let options = ScreenShareCaptureOptions(dimensions: .h720_43,
                                                fps: 5,
                                                includeCurrentApplication: true)

        let mainTrack = LocalVideoTrack.createMacOSScreenShareTrack(source: displaySource, options: options)

        Task { @MainActor in
            self.tracks = [mainTrack]
        }

        await withThrowingTaskGroup(of: Void.self) { group in
            group.addTask {
                try await mainTrack.start()
            }
        }
    }
}

This solution consistently works and provides a convenient resolution. If there is a misunderstanding on my part, and the issue can be resolved without these changes, please reach out to me and provide an explanation.

Thank you in advance!

CLAassistant commented 10 months ago

CLA assistant check
All committers have signed the CLA.

creativecbr commented 10 months ago

I can't sign CLA. Although I have added an email address to my GitHub account, I suspect that the error may have occurred because I pushed a commit without configuring the git user.email. How can I rectify this situation?

creativecbr commented 10 months ago

Feel free to decline this pull request. I can resend it once I've configured Git properly. Alternatively, you can expedite the process by signing the CLA on my behalf. You have my approve.

hiroshihorie commented 10 months ago

Hey. I think I had an option to include current app, but I will take a look !