Problem with react-native-webrtc and react-native-get-random-values

I’m creating a react-native project using typescript.

If I don’t add react-native-webrtc on my package.json I have this error inside react-native-webrtc/src/getUserMedia.ts:

Possible unhandled promise rejection (id:0): TypeError: Cannot read property ‘getUserMedia’ of null

If I add it I have another error that happens only when I import “react-native-get-random-values” in my index.js.

If I don’t import “react-native-get-random-values” I don’t receive this error but I have another issue when a new Subscriber enter in a room.

Somebody know how I can handle this issue?

Hi @Mauro ,

To facilitate a thorough investigation and resolution, I kindly request your assistance in providing additional details.

Before we proceed, could you confirm if you are referring to the official React Native tutorial? It would be beneficial to ascertain if the issue aligns with the content of the official documentation. If you’ve identified the problem in the official tutorial, I will focus my efforts on resolving it using the same sample.

Now, to streamline the troubleshooting process, I would appreciate your input on the following:

  1. OpenVidu-Browser Library Version: Please verify that you have installed the specified version of the openvidu-browser library as required for the OpenVidu-React-Native tutorial. Provide both the version number and the openvidu-browser version itself to ensure compatibility.
  2. Reproduction Steps: Outline the precise steps you followed before encountering the issue. Include any configurations or settings that may have been applied. This information is crucial for me to replicate the problem accurately and diagnose it effectively.

Hope your reply.
Thanks

Hi Santos,
thanks for your interest.
Actually I’m working on two different project to find a solution.

I opened another topic about the issue related to the react-native project in your tutorial. The topic is that one:

About the project in this topic, I created it as new project in typescript so I can’t use the officail tutorial because it’s not written in typescript.
So I converted the code from the official react-native tutorial guidelines and now I can use the React.useState and other new React behaviours and also typescript code and types.
But I followed the instruction in the “Android specific requirements” paragraph.

So, in this project I’m using:

 "openvidu-browser": "^2.29.1",
 "openvidu-react-native-adapter": "file:openvidu-react-native-adapter-2.29.0.tgz"

My conversion to typescript seems to work almost fine and respect the tutorial flow.
As I read around on this forum it’s not necessary to add react-native-webrtc on my package but if I don’t add it I receive this error when I start a call:

Possible unhandled promise rejection (id:0): TypeError: Cannot read property ‘getUserMedia’ of null

(inside react-native-webrtc/src/getUserMedia.ts)

If I try to install react-native-webrtc version 106.0.4, the same version it seems used in openvidu tutorial, my app crashes on startup.
If I install the last version of react-native-webrtc the app doesn’t crash but the app crash when I start a new call. And the reason of this crash seems connected to “react-native-get-random-value” (the error in the image above).
But if I remove “react-native-get-random-value” I have another issue when a new Subscriber enter in a room. The error is about " crypto.getRandomValues()".
I tried also to add “import { v4 as uuidv4 } from ‘uuid’;” after the import of “react-native-get-random-value” but I still receive the error in the image below.

So, these are my problem related to my typescript conversion.