Questions tagged [simple-peer]

Simple WebRTC video, voice, and data channels for nodejs and browser

Homepage + docs

https://github.com/feross/simple-peer

Syntax

var Peer = require('simple-peer')

var peer1 = new Peer({ initiator: true })
var peer2 = new Peer()

peer1.on('signal', data => {
  // when peer1 has signaling data, give it to peer2 somehow
  peer2.signal(data)
})

peer2.on('signal', data => {
  // when peer2 has signaling data, give it to peer1 somehow
  peer1.signal(data)
})

peer1.on('connect', () => {
  // wait for 'connect' event before using the data channel
  peer1.send('hey peer2, how is it going?')
})

peer2.on('data', data => {
  // got a data channel message
  console.log('got a message from peer1: ' + data)
})
94 questions
0
votes
0 answers

How to connect peers using simple-peer with React and Node.js?

I am trying to make a video call on my project and I am using simple-peer to connect 2 peers. I can see all of console.log on Node.js but can get console.log(4) on React. I am not fully understood to WebRTC yet so please understand my broken…
jiaegong
  • 1
  • 2
0
votes
1 answer

how to establish connection between peers in peer js

My aim is connecting webrtc peers and sharing their video, but I'm not able to connect peers in the below code. const [stream, setstream] = useState(); const myVideo = useRef(); const userVideo = useRef(); useEffect(() => { …
titan
  • 45
  • 6
0
votes
1 answer

Why do I receive 2 mediaStreams while adding track to a peer in webRTC?

I am given to understand that RTCPeerConnection.addStream() is deprecated and instead addTrack() should be used in its place. However this causes the server to add two tracks ( audio and video ) hence I receieve 2 mediaStream at my client side. Is…
Hypothesis
  • 1,208
  • 3
  • 17
  • 43
0
votes
1 answer

How to check if a webRTC peer has already have specific tracks assigned to it?

I am trying to understand if there is a way to know if a peer has already been hooked up with a specific audio and/or video track or not because before peer.addTrack(track) I want to make sure a track will not be added twice to the same peer.
Hypothesis
  • 1,208
  • 3
  • 17
  • 43
0
votes
0 answers

Using simple-peer, peer.on('data') calls repeatedly

I am using simple-peer library for making a chat application. When I receive message from the other peer connection using peer.on('data' => (data) => { console.log(data) }), it is called multiple times and I receive the message multiple times.
0
votes
0 answers

My webRTC APP doesn't work on Heroku (Using simple-peer and socket.io)

My webRTC app doesn't work on Heroku, but work on local environment. My Heroku App: https://rgvc-client.herokuapp.com/ Github client: https://github.com/sayagit/RGVC-client Github server: https://github.com/sayagit/RGVC-server What I want to do: If…
sayaka
  • 71
  • 1
  • 5
0
votes
2 answers

Can't send Media Stream of captureStream() through WebRTC

I create a WebRTC with simple peer. I need to capture stream from video element and send it to peers. I use vidEl.captureStream() to get Media Stream from video element and send it to other peer. It's working but only audio and video is…
0
votes
0 answers

How to add Video Track to Simple-Peer stream?

I am trying to add a video track to the user's stream object so that the peers can see it. In componentDidMount() I initially get the permission to use the microphone, but I have a button that I would like to use to add a video track. I have a…
Flashcap
  • 141
  • 2
  • 17
0
votes
1 answer

Is there a way to reconnect two peers after one is destroyed?

I'm working with simple-peer in React.js to implement a video conference. when I connect two peers after they got disconnected, peers get destroyed but I want to reconnect them on the same connection and I don't want to create a new set of peers and…
Kimia Khakzad
  • 203
  • 3
  • 10
0
votes
1 answer

why my simple-peer app doesn't work on server

i have reactjs build in my server side and im rendering it when get requests on '/*'. my problem is when i make calls in localhost it works but when i get a build of project and run it on server sometimes my stream call video does not reach to…
omer98
  • 33
  • 8
0
votes
1 answer

Only one video is playing simultaneously on Safari (Mac)

I used Simple Peer(WebRTC), ReactJS for my video call service. In the video call screen, I used 2 video tags(contact video and user video) for video playback. When the call gets started after a successful connection, only the contact video is…
0
votes
1 answer

WebRTC works localhost and fails on different machines

I am trying to get a hello worlds WebRTC sample working over internet connection not same local machine I am using this code WebRTC Tests
Amr Bedair
  • 196
  • 2
  • 13
0
votes
1 answer

How to fix signal after peer is destroyed?

I am creating a video chat app, but when second person connected, server return some strange errors. Please help me to solve this error. Actual problem comes when I open new tab and paste same URL for testing. I am using "simple-peer":…
Robin Singh
  • 1,565
  • 1
  • 13
  • 38
0
votes
0 answers

I'm trying to include simplepeer.js, but its showing 404 error not found. Instead I'm giving right path

Folder Structure express to access static file. app.use(express.static(__dirname + "/public")) In index.html
Arpit jain
  • 89
  • 6
0
votes
1 answer

POST http://localhost:3000/socket.io/?EIO=3&transport=polling&t=NGO9TCV NOT FOUND

I am trying to make a React web chat platform using webRTC, socket.io-client, and simple-peer. I followed a tutorial and used their code but I keep getting this error. The error happens every second or so and I'm not sure why. Here is my code for…
Anshul S.
  • 21
  • 7