peerjs icon indicating copy to clipboard operation
peerjs copied to clipboard

Peerjs video call is not working on live server

Open pouyapanahandeh opened this issue 5 years ago • 14 comments

Hi everyone,

I built a simple video call service but it's not working, it was working on localhost and after I deployed it on Heroku it stops working. you can check the service here: https://moon-call.herokuapp.com/ when you open the link it will generate id and you can share this id with someone and start talking to each other. you can see the project source code here: https://github.com/pouyapanahandeh/moon

would be great if you can help me to solve this problem, thanks in advance

pouyapanahandeh avatar Jan 16 '21 23:01 pouyapanahandeh

Are you getting the MediaStream object? I am having a similar issue, the Stream is returned un the event but no audio (in this case) in It.

AlvaroHerrero avatar Jan 18 '21 20:01 AlvaroHerrero

Try this it work for me on heroku:

const peer = new Peer({
    key: 'peerjs',
    host: 'yourHerokuHostName.com',
    port: 443,
    path: '/',
    secure: true,
})

In your code you just provide 'host' and 'secure' options that's maybe why, and let the server give a uuid instead of writing 'undefined'. Hope it helps.

ps: i'm using PeerJs Server Buttons for PeerJs server

onadrog avatar Jan 23 '21 14:01 onadrog

Are you getting the MediaStream object? I am having a similar issue, the Stream is returned un the event but no audio (in this case) in It.

Do you get the video on both sides?

pouyapanahandeh avatar Feb 02 '21 11:02 pouyapanahandeh

Try this it work for me on heroku:

const peer = new Peer({
    key: 'peerjs',
    host: 'yourHerokuHostName.com',
    port: 443,
    path: '/',
    secure: true,
})

In your code you just provide 'host' and 'secure' options that's maybe why, and let the server give a uuid instead of writing 'undefined'. Hope it helps.

ps: i'm using PeerJs Server Buttons for PeerJs server

I tried your solution, still is not working

pouyapanahandeh avatar Feb 02 '21 11:02 pouyapanahandeh

Weird, maybe try to check this 2 things. Did you have the socket connection open 'using evt ?

peer.on('open', id => concole.log(id))

According to MDN docs a MediaStream must us secure connection see 'Encryption based security' if you're using it on your local enviroment use something like mkcert to have encryption on your local env.

onadrog avatar Feb 03 '21 14:02 onadrog

I have the same problem. I received the media stream on both sides. The video elements are added to the dom but he video doesn't show up

NdubuisiJr avatar Mar 22 '21 19:03 NdubuisiJr

I have the same problem. I received the media stream on both sides. The video elements are added to the dom but he video doesn't show up

did you find any solution?

pouyapanahandeh avatar Mar 26 '21 05:03 pouyapanahandeh

Ok I am facing something really weird. My both user are get connected when they are in same wifi or same hotspot. But if I change the network (wifi, hotspot) only video sector is visible but not get connected.

tejasthakaregit avatar Mar 28 '21 16:03 tejasthakaregit

Here is my hosting

https://gentle-castle-05941.herokuapp.com/9ea7af70-ab0c-4d89-a06f-e8b6d0888fac

Wait for server to start and then allow camera and audio.

tejasthakaregit avatar Mar 28 '21 16:03 tejasthakaregit

Did anyone manage to solve this? My video chat app was working perfectly fine, but now it's not working, If I am running on the same wifi, it works, but does not work if I ask my friend to join from a different network.

punquz avatar May 06 '21 04:05 punquz

@punquz you should add ICE servers to your config

alialkorsani avatar May 12 '21 19:05 alialkorsani

Hello. I am facing the same issue. Video streams don't show up on both sides. Can someone please tell me the exact solution for this. It would be really helpful.

vaidehi44 avatar Jul 12 '21 22:07 vaidehi44

@vaidehi44 You need to have your own turn server, I have hosted my own turn server in EC2. use this link, https://gabrieltanner.org/blog/turn-server

punquz avatar Jul 13 '21 07:07 punquz

@vaidehi44 You need to have your own turn server, I have hosted my own turn server in EC2. use this link, https://gabrieltanner.org/blog/turn-server

Okay. Thanks.

vaidehi44 avatar Jul 14 '21 10:07 vaidehi44