-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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: [react-native-sdk] Adds screen share support on iOS #14929
base: master
Are you sure you want to change the base?
Conversation
Hi, thanks for your contribution! |
@Calinteodor PTAL. @rcidt we already have an external API equivalent on RN SDK, perhaps this could tap into that 🤔 |
@saghul can you point me in the right direction? |
Here is how a new event was added to the RN SDK: 782d46b You can borrow some inspiration from there I think. |
2632cbd
to
0d5e20d
Compare
@saghul the I had to add a new native module to listen to the darwn notifications coming from the Broadcast Extension on the native side, and then forward those notifications via RCTEventEmitter to the JS side. |
Sorry, my wires crossed, ignore my previous message. We had a similar situation with ongoing notifications on Android. Since we now have basically 2 ways to do the same thing, we could move the current native handling part to JS so the same implementation works for both. |
@saghul that's a fair point |
…moves it into a common screen-share middleware to be used by both native and RN sdks
@saghul I made the suggested changes. I moved the screen share event logic out of the external-api middleware and into a common screen-share middleware to be used by both native and RN sdks. |
0f42a1e
to
3970c86
Compare
3970c86
to
372af28
Compare
@rcidt I tested your PR using the sample app below. |
@rcidt I also tested screen-share feature on our end and it seems that some of the changes here broke it. |
} | ||
|
||
RCT_EXPORT_MODULE(); | ||
|
||
- (NSDictionary *)constantsToExport { |
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.
Please check this warning
Module ScreenShareEventEmitter requires main queue setup since it overrides constantsToExport
but doesn't implement requiresMainQueueSetup
. In a future release React Native will default to initializing all native modules on a background thread unless explicitly opted-out of.
[self handleBroadcastStopped]; | ||
} | ||
|
||
- (void)handleBroadcastStarted { |
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.
Thread 1: "Error when sending event: org.jitsi.meet.TOGGLE_SCREEN_SHARE with body: {\n enabled = 1;\n}. RCTCallableJSModules is not set. This is probably because you've explicitly synthesized the RCTCallableJSModules in ScreenShareEventEmitter, even though it's inherited from RCTEventEmitter."
@Calinteodor thanks for the review. I have tested this using the rnsdk but have not done so with the ios sdk. I'll find some time this week to give it a go and look at these issues. |
Did you test this using the react-native example app, if so what feature is broken? Or did you test using the ios sample app? |
I tested your changes on Jitsi Meet. I mentioned the error above on handleBroadcastStarted. |
This PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
@rcidt Ping, are you still interested in pursuing this? |
Seems like the only reason screen share was not working on RNSDK for ios was because the external api is not present, thus no darwin notification events get received by the JS in order to start the web socket.
In the PR I create a dedicated screen share event emitter module for iOS which listens for darwin notification events and forwards them to the JS side.
I made these changes directly within the node_modules in my main project and it is working fine, so I copied the changes into this fork.
Related issue #14928