react-native-twilio-video-webrtc icon indicating copy to clipboard operation
react-native-twilio-video-webrtc copied to clipboard

fix: updating connect params and avoiding pointers

Open CaptainJeff opened this issue 10 months ago • 2 comments

I just started to experience an issue where my "connect" function wasn't getting called in objective-c. Aftering some debugging, I realized that it was caused by the implementation of BOOL * instead of BOOL

RCT_EXPORT_METHOD(
  connect:(NSString *)accessToken 
  roomName:(NSString *)roomName 
  enableAudio:(BOOL *)enableAudio 
  enableVideo:(BOOL *)enableVideo 
  encodingParameters:(NSDictionary *)encodingParameters 
  enableNetworkQualityReporting:(BOOL *)enableNetworkQualityReporting 
  dominantSpeakerEnabled:(BOOL *)dominantSpeakerEnabled 
  cameraType:(NSString *)cameraType
) {

VS

RCT_EXPORT_METHOD(connect:(NSString *)accessToken
                  roomName:(NSString *)roomName
               enableAudio:(BOOL)enableAudio
               enableVideo:(BOOL)enableVideo
         encodingParameters:(NSDictionary *)encodingParameters
enableNetworkQualityReporting:(BOOL)enableNetworkQualityReporting
     dominantSpeakerEnabled:(BOOL)dominantSpeakerEnabled
                cameraType:(NSString *)cameraType) {

In Objective-C, BOOL is a primitive, not a pointer. Using BOOL * (a pointer) is incorrect unless handling pointers, which we're not doing here. I'm thinking that the BOOL * type may confuse the RN bridge, causing it to drop the method call silently?

And then another change is the default param of encodingParameters from the js should be a dict not null.

CaptainJeff avatar Jan 06 '25 21:01 CaptainJeff

@slycoder think you can give this a look? The current master branch doesn't work for me in ios. The connect request silently drops and the call is never connected.

CaptainJeff avatar Jan 07 '25 14:01 CaptainJeff

@CaptainJeff This worked for me. Thanks.

x9bbb avatar Feb 11 '25 00:02 x9bbb