Cannot read property 'call' of undefined
- Dominant language
- JavaScript
- Stars
- 7.8k
- Forks
- 983
- PR merge metrics
- No merged PRs in 30d
Description
I get this error when using the lib in the browser:
```
Uncaught (in promise) TypeError: Cannot read property 'call' of undefined
at new hd (vendor.57ab6ea3.js:19)
at new vh (vendor.57ab6ea3.js:22)
at index.c008e8f0.js:1
hd @ vendor.57ab6ea3.js:19
vh @ vendor.57ab6ea3.js:22
(anonymous) @ index.c008e8f0.js:1
Promise.then (async)
sendMic @ index.c008e8f0.js:1
wt @ vendor.57ab6ea3.js:1
Et @ vendor.57ab6ea3.js:1
n @ vendor.57ab6ea3.js:1
```
the stack trace is obfuscated but the line it points to seems to be in the `readable-stream` module. (i think its this one? https://github.com/nodejs/readable-stream/blob/master/lib/_stream_duplex.js#L60)
Code:
```ts
navigator.mediaDevices.getUserMedia({
audio: true,
video: false
}).then((stream) => {
createPeer(this.socket as Socket);
peer.addStream(stream);
});
}
```
```ts
function createPeer(socket: Socket) {
if (!peer) {
peer = new Peer({
initiator: true
});
socket.on('peer-signal', (data) => {
peer.signal(data);
});
peer.on('signal', data => {
socket.emit('peer-signal', data)
});
}
return peer;
}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.