From 651d8cfa88a8c0a135b00aa378230266c786b584 Mon Sep 17 00:00:00 2001 From: Tiago Daniel Jacobs Date: Tue, 8 Nov 2022 22:24:59 -0300 Subject: [PATCH] feat(stun-turn): add parameter to receive stun/turn servers --- ios/ReactExported/FullAudioServiceManager.m | 2 +- ios/ReactExported/FullAudioServiceManager.swift | 4 ++-- ios/ReactExported/ScreenShareServiceManager.m | 2 +- ios/ReactExported/ScreenShareServiceManager.swift | 4 ++-- package.json | 2 +- src/methods/createFullAudioOffer.tsx | 6 +++--- src/methods/createScreenShareOffer.tsx | 6 +++--- src/native-components/BBBN_FullAudioService.tsx | 4 ++-- src/native-components/BBBN_ScreenShareService.tsx | 4 ++-- src/webview/message-handler.tsx | 4 ++-- 10 files changed, 19 insertions(+), 19 deletions(-) diff --git a/ios/ReactExported/FullAudioServiceManager.m b/ios/ReactExported/FullAudioServiceManager.m index a215dfd..0994df3 100644 --- a/ios/ReactExported/FullAudioServiceManager.m +++ b/ios/ReactExported/FullAudioServiceManager.m @@ -9,7 +9,7 @@ #import "React/RCTBridgeModule.h" @interface RCT_EXTERN_REMAP_MODULE(BBBN_FullAudioService, FullAudioServiceManager, NSObject) -RCT_EXTERN_METHOD(createFullAudioOffer) +RCT_EXTERN_METHOD(createFullAudioOffer: (NSString *)stunTurnJson) RCT_EXTERN_METHOD(setFullAudioRemoteSDP: (NSString *)remoteSDP) RCT_EXTERN_METHOD(addFullAudioRemoteIceCandidate: (NSString *)remoteCandidate) diff --git a/ios/ReactExported/FullAudioServiceManager.swift b/ios/ReactExported/FullAudioServiceManager.swift index c4b37c2..ba03f3c 100644 --- a/ios/ReactExported/FullAudioServiceManager.swift +++ b/ios/ReactExported/FullAudioServiceManager.swift @@ -18,8 +18,8 @@ class FullAudioServiceManager: NSObject { var fullAudioService: FullAudioService = FullAudioService( ) // React native exposed method (called when user click the button to share screen) - @objc func createFullAudioOffer() -> Void { - logger.info("createFullAudioOffer") + @objc func createFullAudioOffer(_ stunTurnJson:String) -> Void { + logger.info("createFullAudioOffer \(stunTurnJson)") Task.init { let optionalSdp = await self.fullAudioService.createOffer() if(optionalSdp != nil){ diff --git a/ios/ReactExported/ScreenShareServiceManager.m b/ios/ReactExported/ScreenShareServiceManager.m index 922aea1..f1bbe76 100644 --- a/ios/ReactExported/ScreenShareServiceManager.m +++ b/ios/ReactExported/ScreenShareServiceManager.m @@ -11,7 +11,7 @@ RCT_EXTERN_METHOD(stopScreenShareBroadcastExtension) RCT_EXTERN_METHOD(initializeScreenShare) -RCT_EXTERN_METHOD(createScreenShareOffer) +RCT_EXTERN_METHOD(createScreenShareOffer: (NSString *)stunTurnJson) RCT_EXTERN_METHOD(setScreenShareRemoteSDP: (NSString *)remoteSDP) RCT_EXTERN_METHOD(addScreenShareRemoteIceCandidate: (NSString *)remoteCandidate) diff --git a/ios/ReactExported/ScreenShareServiceManager.swift b/ios/ReactExported/ScreenShareServiceManager.swift index 8ca06e7..a3bf8ef 100644 --- a/ios/ReactExported/ScreenShareServiceManager.swift +++ b/ios/ReactExported/ScreenShareServiceManager.swift @@ -53,8 +53,8 @@ class ScreenShareServiceManager: NSObject { } // React native exposed method (called when user click the button to share screen) - @objc func createScreenShareOffer() -> Void { - logger.info("createScreenShareOffer") + @objc func createScreenShareOffer(_ stunTurnJson:String) -> Void { + logger.info("createScreenShareOffer \(stunTurnJson)") // Send request of SDP to the broadcast upload extension // TIP - the handling of SDP response is done in observer2 of BigBlueButtonSDK class diff --git a/package.json b/package.json index b632aca..f0c1689 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bigbluebutton-tablet-sdk", - "version": "0.1.33", + "version": "0.1.34", "description": "test", "main": "lib/commonjs/index", "module": "lib/module/index", diff --git a/src/methods/createFullAudioOffer.tsx b/src/methods/createFullAudioOffer.tsx index b99c5d8..e2de481 100644 --- a/src/methods/createFullAudioOffer.tsx +++ b/src/methods/createFullAudioOffer.tsx @@ -14,15 +14,15 @@ nativeEmitter.addListener('onFullAudioOfferCreated', (sdp) => { }); // Entry point of this method -function createFullAudioOffer(instanceId: Number) { +function createFullAudioOffer(instanceId: Number, stunTurnJson: String) { return new Promise((res, rej) => { // store the resolver for later call (when event is received) resolve = res; try { - console.log(`[${instanceId}] - >nativeCreateFullAudioOffer`); + console.log(`[${instanceId}] - >nativeCreateFullAudioOffer (${stunTurnJson})`); // call native swift method that triggers the broadcast popup - nativeCreateFullAudioOffer(); + nativeCreateFullAudioOffer(stunTurnJson); } catch (e) { rej(`Call to nativeCreateFullAudioOffer failed`); } diff --git a/src/methods/createScreenShareOffer.tsx b/src/methods/createScreenShareOffer.tsx index 5f80a0a..1def91f 100644 --- a/src/methods/createScreenShareOffer.tsx +++ b/src/methods/createScreenShareOffer.tsx @@ -14,15 +14,15 @@ nativeEmitter.addListener('onScreenShareOfferCreated', (sdp) => { }); // Entry point of this method -function createScreenShareOffer(instanceId: Number) { +function createScreenShareOffer(instanceId: Number, stunTurnJson: String) { return new Promise((res, rej) => { // store the resolver for later call (when event is received) resolve = res; try { - console.log(`[${instanceId}] - >nativeCreateScreenShareOffer`); + console.log(`[${instanceId}] - >nativeCreateScreenShareOffer (${stunTurnJson})`); // call native swift method that triggers the broadcast popup - nativeCreateScreenShareOffer(); + nativeCreateScreenShareOffer(stunTurnJson); } catch (e) { rej(`Call to nativeCreateScreenShareOffer failed`); } diff --git a/src/native-components/BBBN_FullAudioService.tsx b/src/native-components/BBBN_FullAudioService.tsx index 7939e78..1237a04 100644 --- a/src/native-components/BBBN_FullAudioService.tsx +++ b/src/native-components/BBBN_FullAudioService.tsx @@ -6,8 +6,8 @@ const FullAudioService = NativeModules.BBBN_FullAudioService; // FullAudioService.initializeFullAudio(); // } -export function createFullAudioOffer() { - FullAudioService.createFullAudioOffer(); +export function createFullAudioOffer(stunTurnJson:String) { + FullAudioService.createFullAudioOffer(stunTurnJson); } export function setFullAudioRemoteSDP(remoteSDP: string) { diff --git a/src/native-components/BBBN_ScreenShareService.tsx b/src/native-components/BBBN_ScreenShareService.tsx index 963be43..1907fdc 100644 --- a/src/native-components/BBBN_ScreenShareService.tsx +++ b/src/native-components/BBBN_ScreenShareService.tsx @@ -6,8 +6,8 @@ export function initializeScreenShare() { ScreenShareService.initializeScreenShare(); } -export function createScreenShareOffer() { - ScreenShareService.createScreenShareOffer(); +export function createScreenShareOffer(stunTurnJson:String) { + ScreenShareService.createScreenShareOffer(stunTurnJson); } export function setScreenShareRemoteSDP(remoteSDP: string) { diff --git a/src/webview/message-handler.tsx b/src/webview/message-handler.tsx index 3e0b14c..4f5dafd 100644 --- a/src/webview/message-handler.tsx +++ b/src/webview/message-handler.tsx @@ -50,10 +50,10 @@ export function handleWebviewMessage( promise = initializeScreenShare(instanceId); break; case 'createFullAudioOffer': - promise = createFullAudioOffer(instanceId); + promise = createFullAudioOffer(instanceId, JSON.stringify(data?.arguments[0])); break; case 'createScreenShareOffer': - promise = createScreenShareOffer(instanceId); + promise = createScreenShareOffer(instanceId, JSON.stringify(data?.arguments[0])); break; case 'setScreenShareRemoteSDP': promise = setScreenShareRemoteSDP(instanceId, data?.arguments[0].sdp);