forked from livekit/react-native-webrtc
-
Notifications
You must be signed in to change notification settings - Fork 2
feat: screen share audio #28
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
Open
greenfrvr
wants to merge
14
commits into
master
Choose a base branch
from
screen-share-audio
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
1a6bdbb
feat: added captured audio for screen sharing for Android
greenfrvr c4637a2
feat: added in app screen sharing
greenfrvr 1364e73
feat: handle screen capturing on app state changes
greenfrvr bc5de6a
feat: added ios screen share audio capturing
greenfrvr f64916f
chore: adjusted android mix summing
greenfrvr e34e257
chore: ios moved to mixer node implementation
greenfrvr 3691b7e
chore: removed diagnostic logs
greenfrvr 9fa28d3
chore: added in app screen sharing restoration
greenfrvr b099459
chore: code cleanup
greenfrvr 160d8b1
chore: made mixer initialization lazy
greenfrvr 351879c
chore: pr comment fix
greenfrvr 7e4c015
chore: audio capture improvement
greenfrvr f8929b5
chore: code cleanup
greenfrvr c1b1d6c
chore: small tweak
greenfrvr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| #import <Foundation/Foundation.h> | ||
| #import "CaptureController.h" | ||
| #import "CapturerEventsDelegate.h" | ||
|
|
||
| NS_ASSUME_NONNULL_BEGIN | ||
|
|
||
| @class InAppScreenCapturer; | ||
|
|
||
| @interface InAppScreenCaptureController : CaptureController | ||
|
|
||
| - (instancetype)initWithCapturer:(nonnull InAppScreenCapturer *)capturer; | ||
|
|
||
| /// The underlying RPScreenRecorder-based capturer. | ||
| @property(nonatomic, strong, readonly) InAppScreenCapturer *capturer; | ||
|
|
||
| @end | ||
|
|
||
| NS_ASSUME_NONNULL_END |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| #if TARGET_OS_IOS | ||
|
|
||
| #import "InAppScreenCaptureController.h" | ||
| #import "InAppScreenCapturer.h" | ||
|
|
||
| @interface InAppScreenCaptureController () <CapturerEventsDelegate> | ||
| @end | ||
|
|
||
| @implementation InAppScreenCaptureController | ||
|
|
||
| - (instancetype)initWithCapturer:(nonnull InAppScreenCapturer *)capturer { | ||
| self = [super init]; | ||
| if (self) { | ||
| _capturer = capturer; | ||
| _capturer.eventsDelegate = self; | ||
| self.deviceId = @"in-app-screen-capture"; | ||
| } | ||
| return self; | ||
| } | ||
|
|
||
| - (void)dealloc { | ||
| [self.capturer stopCapture]; | ||
| } | ||
|
|
||
| - (void)startCapture { | ||
| [self.capturer startCapture]; | ||
| } | ||
|
|
||
| - (void)stopCapture { | ||
| [self.capturer stopCapture]; | ||
| } | ||
|
|
||
| - (NSDictionary *)getSettings { | ||
| return @{ | ||
| @"deviceId": self.deviceId ?: @"in-app-screen-capture", | ||
| @"groupId": @"", | ||
| @"frameRate": @(30) | ||
| }; | ||
| } | ||
|
|
||
| #pragma mark - CapturerEventsDelegate | ||
|
|
||
| - (void)capturerDidEnd:(RTCVideoCapturer *)capturer { | ||
| [self.eventsDelegate capturerDidEnd:capturer]; | ||
| } | ||
|
|
||
| @end | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| #import <AVFoundation/AVFoundation.h> | ||
| #import <WebRTC/RTCVideoCapturer.h> | ||
| #import "CapturerEventsDelegate.h" | ||
|
|
||
| NS_ASSUME_NONNULL_BEGIN | ||
|
|
||
| @interface InAppScreenCapturer : RTCVideoCapturer | ||
|
|
||
| @property(nonatomic, weak) id<CapturerEventsDelegate> eventsDelegate; | ||
|
|
||
| /// Callback invoked for each .audioApp CMSampleBuffer from RPScreenRecorder. | ||
| /// Set this before calling startCapture if audio mixing is desired. | ||
| @property(nonatomic, copy, nullable) void (^audioBufferHandler)(CMSampleBufferRef); | ||
|
|
||
| - (instancetype)initWithDelegate:(__weak id<RTCVideoCapturerDelegate>)delegate; | ||
| - (void)startCapture; | ||
| - (void)stopCapture; | ||
|
|
||
| @end | ||
|
|
||
| NS_ASSUME_NONNULL_END |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: GetStream/react-native-webrtc
Length of output: 462
🏁 Script executed:
# First, get the full GetUserMediaImpl.java file to understand the context wc -l android/src/main/java/com/oney/WebRTCModule/GetUserMediaImpl.javaRepository: GetStream/react-native-webrtc
Length of output: 142
🏁 Script executed:
Repository: GetStream/react-native-webrtc
Length of output: 1117
🏁 Script executed:
Repository: GetStream/react-native-webrtc
Length of output: 140
🏁 Script executed:
Repository: GetStream/react-native-webrtc
Length of output: 545
🏁 Script executed:
Repository: GetStream/react-native-webrtc
Length of output: 55
🏁 Script executed:
Repository: GetStream/react-native-webrtc
Length of output: 1315
🏁 Script executed:
Repository: GetStream/react-native-webrtc
Length of output: 1627
🏁 Script executed:
Repository: GetStream/react-native-webrtc
Length of output: 55
🏁 Script executed:
Repository: GetStream/react-native-webrtc
Length of output: 3201
🏁 Script executed:
Repository: GetStream/react-native-webrtc
Length of output: 215
🏁 Script executed:
Repository: GetStream/react-native-webrtc
Length of output: 806
🏁 Script executed:
Repository: GetStream/react-native-webrtc
Length of output: 3934
🏁 Script executed:
Repository: GetStream/react-native-webrtc
Length of output: 1290
🏁 Script executed:
Repository: GetStream/react-native-webrtc
Length of output: 2163
🏁 Script executed:
Repository: GetStream/react-native-webrtc
Length of output: 1668
🏁 Script executed:
Repository: GetStream/react-native-webrtc
Length of output: 600
🏁 Script executed:
Repository: GetStream/react-native-webrtc
Length of output: 590
🏁 Script executed:
Repository: GetStream/react-native-webrtc
Length of output: 2582
🏁 Script executed:
Repository: GetStream/react-native-webrtc
Length of output: 1310
🏁 Script executed:
Repository: GetStream/react-native-webrtc
Length of output: 1128
🏁 Script executed:
Repository: GetStream/react-native-webrtc
Length of output: 2344
🏁 Script executed:
Repository: GetStream/react-native-webrtc
Length of output: 1744
🏁 Script executed:
Repository: GetStream/react-native-webrtc
Length of output: 55
🏁 Script executed:
Repository: GetStream/react-native-webrtc
Length of output: 4173
🏁 Script executed:
Repository: GetStream/react-native-webrtc
Length of output: 146
Add lifecycle management to clear the retained Intent when screen sharing ends.
The
mediaProjectionPermissionResultDataIntent is retained for reuse inAudioPlaybackCaptureConfiguration, but there's no mechanism to clear it when:ScreenCapturerAndroid.onStop()callback firesSince
getMediaProjectionPermissionResultData()is a public API, external consumers could retrieve and use a stale Intent for audio capture, which would fail. Either clear the Intent explicitly when the MediaProjection ends, or add validation to ensure freshness before use.🤖 Prompt for AI Agents