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
2
votes
1 answer

Adding streams and tracks via simple-peer in react

I am working on online conferencing code in react. I am using simple-peer as a WebRTC wrapper whereby I started with simple-peer-react and build on top of it. I am now trying to dynamically add a stream/track to the peer while the connection is…
Alex
  • 153
  • 1
  • 7
2
votes
2 answers

How to do screen sharing with simple-peer webRTC SDK

I'm trying to implement webrtc & simple peer to my chat. Everything works but I would like to add screen sharing option. For that I tried that: $("#callScreenShare").click(async function(){ if(captureStream != null){ …
johannb75
  • 357
  • 5
  • 16
2
votes
0 answers

Failed to execute 'setRemoteDescription' on 'RTCPeerConnection'

I am trying to set up a webrtc signaling service using SignalHub and SimplePeer. But when executing I get the following error: Uncaught (in promise) Error: InvalidStateError: Failed to execute 'setRemoteDescription' on 'RTCPeerConnection': Failed to…
Johann Süß
  • 97
  • 1
  • 12
2
votes
0 answers

index.js:4 NotSupportedError: MediaStreamError found in simple peer

I used simple peer js for peer to peer connection in node JS. But Iam getting this error index.js:4 NotSupportedError: MediaStreamError here is my code index.js var getUserMedia = require('getusermedia') getUserMedia({ video: true, audio: false…
Tut neil
  • 81
  • 4
2
votes
1 answer

WebRTC (simple-peer) + STUN Without Extra Signaling?

I'm trying to use the simple-peer library to establish browser-to-browser WebRTC connections (data channels). It's my understanding (Maybe I have some misconception) that in order for two browsers to connect via WebRTC, they must exchange SDP data…
xendi
  • 2,332
  • 5
  • 40
  • 64
2
votes
1 answer

TypeError: pna.nextTick is not a function using simple-peer in angular 7

I am using simple-peer in angular 7 async ngOnInit() { try { if (location.hash === '#init') { this.peer = new SimplePeer({ initiator: location.hash === '#init' }) } else { this.peer = new…
WasiF
  • 26,101
  • 16
  • 120
  • 128
1
vote
0 answers

can not get peer stream because of re render issue

I'm trying to create a video chat with react.js and there is an issue that I don't know how to solve. I need to save peer stream from peer.on('stream',...) when it appears, but as it appears at the second render and I set empty array as dependency…
Vahan
  • 151
  • 1
  • 1
  • 5
1
vote
1 answer

caught (in promise) TypeError: Cannot read properties of undefined (reading 'call') at Peer.Readable (_stream_readable.js:178:10)

Follow the demo to do the multiple users conferencing, the demo was not created based on react vite, but I do. The code is similar with the demo, but it shows the error. Is this caused by vite? I have used "vite-compatible-simple-peer" as well but…
777kkk
  • 11
  • 3
1
vote
2 answers

ReactJS and PeerJS (simple-peer) Uncaught (in promise) TypeError: Cannot set properties of null (setting 'srcObject')

I wanted to add an video call feature with WebRTC into my chat webapp. So after writing the code i tested the code. -> No video and in the console the error "Uncaught (in promise) TypeError: Cannot set properties of null (setting…
1
vote
1 answer

Cannot set properties of undefined (setting 'srcObject')

I am trying to stream a video, but when i set 'myVideo.current.srcObject = currentStream' as in the code below, I recieve an error 'Cannot set properties of undefined (setting 'srcObject')' const myVideo = useRef({}); const userVideo = useRef({});…
1
vote
0 answers

The MediaStreamTrack.stop() method stops the track is not working. Still camera is on

I created a video calling system. But when I disconnect the call the camera should off. I used MediaStreamTrack.stop() to stop all tracks but it's not working. Code to stop the stream:- const tracks = stream.getTracks(); tracks.forEach((track)…
kevin
  • 11
  • 3
1
vote
2 answers

Uncaught ReferenceError: global is not defined in React using simple-peer package

I am trying to build a live video and audio streaming platform in Vite(React). I tried peerjs which worked fine but I had to pass the MediaStream object of the viewer for it to connect but I want my app to be One-to-many which means only the Admin…
1
vote
0 answers

Yjs y-webrtc simple peer issue (Yjs + codemirror 6, sync content among editors)

I am using Yjs with codemirrow 6 in my project. I followed codemirror 6 examples and Yjs codemirror.next example (https://github.com/yjs/y-codemirror.next) in github. And when I ran it, I got this error. Here is the source. Please help. Any idea…
Charles
  • 675
  • 3
  • 12
  • 21
1
vote
1 answer

How to add stream dynamically with multiple users with socketio as a non initiator

I've got webRTC to work on my express server but I want to be able to add the stream of the user dynamically. I looked up in the simple-peer docs and found this: var Peer = require('simple-peer') // create peer without waiting for media var peer1 =…
NoobSailboat
  • 109
  • 9
1
vote
0 answers

Simple-peer. Cannot signal after peer is destroyed

This seems to be a quite common issue with Simple-peer. I have simple video chat app which connects 2 peers using WebRTC, Socket.io and Simple-peer. When I peer 1 calls Peer 2 for the first time, everything is fine. Same with 2nd call (so…
KiranM
  • 35
  • 4