-
-
Notifications
You must be signed in to change notification settings - Fork 381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Right side video not coming #17
Comments
Yes I have also tested even with your code and I followed along with your tutorials I have created from scratch both are same but rightside video is not working |
Hi Everyone. I really hope have helped. ... |
Hi there! I noticed you're experiencing issues with the video ref not updating properly in React 18. This is a common issue due to the new concurrent features in React 18, which can affect how updates to the DOM are handled, especially for media streams. I've encountered a similar problem and found a solution that worked well for me. Here's how you can approach it: The key is to use useEffect to handle the assignment of the stream to your video element (myVideo and userVideo in your case) whenever the stream changes. This ensures that any change in the stream is promptly reflected in the video element. Here's an example based on the original code from this repo:
This code will effectively update the srcObject of your video elements whenever the stream changes or the ref to the video element is set. Explanation: Handling Stream Changes: By managing the stream with useEffect, you ensure that the video element always has the latest stream assigned to its srcObject. This is crucial for applications handling real-time media streams. Implementing this change should help in ensuring that updates to your stream are consistently reflected in your video elements, addressing the issue you're facing in React 18. Hope this helps! Let me know if you have any more questions or issues. |
I have tested a lot with even myvideo but the right side video does not seem to appear I have tried everything
I also wrote a js statement to see if the uservideo exists which comes out to be true
I am not able to view myvideo as well right side
it only appears if I refresh the page
The text was updated successfully, but these errors were encountered: