feat(stun-turn): add parameter to receive stun/turn servers

This commit is contained in:
Tiago Daniel Jacobs 2022-11-08 22:24:59 -03:00
parent f39160a5f0
commit 651d8cfa88
10 changed files with 19 additions and 19 deletions

View File

@ -9,7 +9,7 @@
#import "React/RCTBridgeModule.h" #import "React/RCTBridgeModule.h"
@interface RCT_EXTERN_REMAP_MODULE(BBBN_FullAudioService, FullAudioServiceManager, NSObject) @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(setFullAudioRemoteSDP: (NSString *)remoteSDP)
RCT_EXTERN_METHOD(addFullAudioRemoteIceCandidate: (NSString *)remoteCandidate) RCT_EXTERN_METHOD(addFullAudioRemoteIceCandidate: (NSString *)remoteCandidate)

View File

@ -18,8 +18,8 @@ class FullAudioServiceManager: NSObject {
var fullAudioService: FullAudioService = FullAudioService( ) var fullAudioService: FullAudioService = FullAudioService( )
// React native exposed method (called when user click the button to share screen) // React native exposed method (called when user click the button to share screen)
@objc func createFullAudioOffer() -> Void { @objc func createFullAudioOffer(_ stunTurnJson:String) -> Void {
logger.info("createFullAudioOffer") logger.info("createFullAudioOffer \(stunTurnJson)")
Task.init { Task.init {
let optionalSdp = await self.fullAudioService.createOffer() let optionalSdp = await self.fullAudioService.createOffer()
if(optionalSdp != nil){ if(optionalSdp != nil){

View File

@ -11,7 +11,7 @@
RCT_EXTERN_METHOD(stopScreenShareBroadcastExtension) RCT_EXTERN_METHOD(stopScreenShareBroadcastExtension)
RCT_EXTERN_METHOD(initializeScreenShare) RCT_EXTERN_METHOD(initializeScreenShare)
RCT_EXTERN_METHOD(createScreenShareOffer) RCT_EXTERN_METHOD(createScreenShareOffer: (NSString *)stunTurnJson)
RCT_EXTERN_METHOD(setScreenShareRemoteSDP: (NSString *)remoteSDP) RCT_EXTERN_METHOD(setScreenShareRemoteSDP: (NSString *)remoteSDP)
RCT_EXTERN_METHOD(addScreenShareRemoteIceCandidate: (NSString *)remoteCandidate) RCT_EXTERN_METHOD(addScreenShareRemoteIceCandidate: (NSString *)remoteCandidate)

View File

@ -53,8 +53,8 @@ class ScreenShareServiceManager: NSObject {
} }
// React native exposed method (called when user click the button to share screen) // React native exposed method (called when user click the button to share screen)
@objc func createScreenShareOffer() -> Void { @objc func createScreenShareOffer(_ stunTurnJson:String) -> Void {
logger.info("createScreenShareOffer") logger.info("createScreenShareOffer \(stunTurnJson)")
// Send request of SDP to the broadcast upload extension // Send request of SDP to the broadcast upload extension
// TIP - the handling of SDP response is done in observer2 of BigBlueButtonSDK class // TIP - the handling of SDP response is done in observer2 of BigBlueButtonSDK class

View File

@ -1,6 +1,6 @@
{ {
"name": "bigbluebutton-tablet-sdk", "name": "bigbluebutton-tablet-sdk",
"version": "0.1.33", "version": "0.1.34",
"description": "test", "description": "test",
"main": "lib/commonjs/index", "main": "lib/commonjs/index",
"module": "lib/module/index", "module": "lib/module/index",

View File

@ -14,15 +14,15 @@ nativeEmitter.addListener('onFullAudioOfferCreated', (sdp) => {
}); });
// Entry point of this method // Entry point of this method
function createFullAudioOffer(instanceId: Number) { function createFullAudioOffer(instanceId: Number, stunTurnJson: String) {
return new Promise((res, rej) => { return new Promise((res, rej) => {
// store the resolver for later call (when event is received) // store the resolver for later call (when event is received)
resolve = res; resolve = res;
try { try {
console.log(`[${instanceId}] - >nativeCreateFullAudioOffer`); console.log(`[${instanceId}] - >nativeCreateFullAudioOffer (${stunTurnJson})`);
// call native swift method that triggers the broadcast popup // call native swift method that triggers the broadcast popup
nativeCreateFullAudioOffer(); nativeCreateFullAudioOffer(stunTurnJson);
} catch (e) { } catch (e) {
rej(`Call to nativeCreateFullAudioOffer failed`); rej(`Call to nativeCreateFullAudioOffer failed`);
} }

View File

@ -14,15 +14,15 @@ nativeEmitter.addListener('onScreenShareOfferCreated', (sdp) => {
}); });
// Entry point of this method // Entry point of this method
function createScreenShareOffer(instanceId: Number) { function createScreenShareOffer(instanceId: Number, stunTurnJson: String) {
return new Promise((res, rej) => { return new Promise((res, rej) => {
// store the resolver for later call (when event is received) // store the resolver for later call (when event is received)
resolve = res; resolve = res;
try { try {
console.log(`[${instanceId}] - >nativeCreateScreenShareOffer`); console.log(`[${instanceId}] - >nativeCreateScreenShareOffer (${stunTurnJson})`);
// call native swift method that triggers the broadcast popup // call native swift method that triggers the broadcast popup
nativeCreateScreenShareOffer(); nativeCreateScreenShareOffer(stunTurnJson);
} catch (e) { } catch (e) {
rej(`Call to nativeCreateScreenShareOffer failed`); rej(`Call to nativeCreateScreenShareOffer failed`);
} }

View File

@ -6,8 +6,8 @@ const FullAudioService = NativeModules.BBBN_FullAudioService;
// FullAudioService.initializeFullAudio(); // FullAudioService.initializeFullAudio();
// } // }
export function createFullAudioOffer() { export function createFullAudioOffer(stunTurnJson:String) {
FullAudioService.createFullAudioOffer(); FullAudioService.createFullAudioOffer(stunTurnJson);
} }
export function setFullAudioRemoteSDP(remoteSDP: string) { export function setFullAudioRemoteSDP(remoteSDP: string) {

View File

@ -6,8 +6,8 @@ export function initializeScreenShare() {
ScreenShareService.initializeScreenShare(); ScreenShareService.initializeScreenShare();
} }
export function createScreenShareOffer() { export function createScreenShareOffer(stunTurnJson:String) {
ScreenShareService.createScreenShareOffer(); ScreenShareService.createScreenShareOffer(stunTurnJson);
} }
export function setScreenShareRemoteSDP(remoteSDP: string) { export function setScreenShareRemoteSDP(remoteSDP: string) {

View File

@ -50,10 +50,10 @@ export function handleWebviewMessage(
promise = initializeScreenShare(instanceId); promise = initializeScreenShare(instanceId);
break; break;
case 'createFullAudioOffer': case 'createFullAudioOffer':
promise = createFullAudioOffer(instanceId); promise = createFullAudioOffer(instanceId, JSON.stringify(data?.arguments[0]));
break; break;
case 'createScreenShareOffer': case 'createScreenShareOffer':
promise = createScreenShareOffer(instanceId); promise = createScreenShareOffer(instanceId, JSON.stringify(data?.arguments[0]));
break; break;
case 'setScreenShareRemoteSDP': case 'setScreenShareRemoteSDP':
promise = setScreenShareRemoteSDP(instanceId, data?.arguments[0].sdp); promise = setScreenShareRemoteSDP(instanceId, data?.arguments[0].sdp);