-
-
Notifications
You must be signed in to change notification settings - Fork 867
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
need to add breakpoint or setTimeout method to get it work #56
Comments
Thanks. I was also facing the same problem. The myPeer.on("call") methods was also not getting triggered so I taught there was a problem with PeerJS. This fixes the issue. |
I believe the issue is a race condition between then the peer connection is ready and when the webcam/usermedia promise resolved. Because of this, the other peers try to call the new users before they've subscribed to the on.call event. A cheap solution is moving the entire user media promise chain into the on.open event.
|
Thanks. I was facing the same problem, your
|
God |
It's working with me, but create 1 video undefined |
I run the code locally, use chrome to vist http://localhost:3000/ , and it redirect to the room address 'http://localhost:3000/fe3b88cb-8749-44a4-ab6e-aed79bd23fe4' .
then I open another tab in incognito mode with the same room address, but I can only see one video element in each tab .
F12, open my devtool , and add breakpoint on this line (in both two tab) ,refresh one of the page.
the program stop at this line ,I resume. then there are two video element, it works!
I was thinking there migth be a race problem. the
connectToNewUser
get executed before themyPeer.on('call')
, so I add a setTimeout method.and this time , without adding the breakpoint , there are two video elements in each tab.
does anyone have any ideas about what's happening here or is there a better solution in this case?
cause it seems setTimeout it's a bad practice .
The text was updated successfully, but these errors were encountered: