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"
@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)

View File

@ -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){

View File

@ -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)

View File

@ -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

View File

@ -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",

View File

@ -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`);
}

View File

@ -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`);
}

View File

@ -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) {

View File

@ -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) {

View File

@ -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);