can you please help me to fix this error, i am getting this error mediasoupClient.registerGlobals is not a function
my mediasoup version is “mediasoup-client”: “^3.17.1” and webrtc version is “react-native-webrtc”: “^124.0.7”,
and this is my code
import {
RTCPeerConnection,
RTCIceCandidate,
RTCSessionDescription,
MediaStream,
MediaStreamTrack,
mediaDevices,
} from ‘react-native-webrtc’;
import * as mediasoupClient from ‘mediasoup-client’;
mediasoupClient.registerGlobals({
RTCPeerConnection,
RTCIceCandidate,
RTCSessionDescription,
MediaStream,
MediaStreamTrack,
mediaDevices,
});
try {
device = new mediasoupClient.Device();
} catch (error) {
if (error.name === ‘UnsupportedError’) {
console.error(‘browser not supported’);
}
}
what is the correct way, do i just need to call this function without any parameters
like this registerGlobals()
but when i am adding this line i am getting this error mediasoupClient.registerGlobals is not a function
Check the signature of that function. Anyway, you will of course get the same error using it one way or another because those arguments are of course ignored.
Enable full debugs in mediasoup-client and show the full logs.
@ibc bro it is fixed now this is overview about issue and how i fixed that Error: mediasoup-client threw UnsupportedError: device not supported because it couldn’t detect React Native WebRTC support.
Root Cause: The library requires RTCRtpTransceiver to be globally available to identify React Native environment, but it wasn’t imported or set.
Fix: Added RTCRtpTransceiver import from react-native-webrtc and set it globally before importing mediasoup-client. This allows the library to properly detect React Native and use the ReactNative106 handler for WebRTC communication.
Then you should report an issue in react-native-webrtc project or write a PR for it because this is a bug. registerGlobals() should also put RTCRtoTransceiver in global. Will you do it?