You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I read the comment on Issue: #29 and then tried to add a video track to the connection analog the description from here: https://webrtc.org/getting-started/remote-streams . The first issue was to get the peerConnection, which I managed to do with a hook at:
this._pc = new (this._wrtc.RTCPeerConnection)(this.config)
I was testing video call with P2PT today and encounter the same issue — unable to get any track event on a peer.
P2PT uses bittorrent-tracker's WebSocketTracker for finding peers and connecting to them, and WebSocketTracker depends on simple-peer for handling WebRTC.
I did some research and found that in bittorrent-tracker's WebSocketTracker, simple-peer's signal event is handled only once (code), just for establishing the initial connection with a data channel. This causes the required WebRTC renegotiation after adding video tracks to fail (can't exchange offer and answer with new config again through signaling, MDN). Therefore, no track is send to peers and there is no track event.
To solve this issue, I think we need to modify the WebSocketTracker to keep signaling active. We might need to fork it as well. By looking the latest version's code, the developers of bittorrent-tracker seem to focus more on the performance of WebTorrent use case. They even have switched to @thaunknown/simple-peer/lite.js, which removes all media related features from the original simple-peer.
Hello,
I read the comment on Issue: #29 and then tried to add a video track to the connection analog the description from here: https://webrtc.org/getting-started/remote-streams . The first issue was to get the peerConnection, which I managed to do with a hook at:
this._pc = new (this._wrtc.RTCPeerConnection)(this.config)
else I could only grab the peerConnection at:
p2pt.on('peerconnect', peer => peer._pc)
which according to the https://webrtc.org/getting-started/remote-streams here would be too late but I am not certain. Anyhow, in a further step I add the video and audio tracks:
p2pt.on('track', event => console.log('p2ptTrack', event))
pc.addEventListener('track', event => console.log('pcTrack', event))
// https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia
navigator.mediaDevices.getUserMedia({
audio: true, // We want an audio track
video: true // And we want a video track
}) .then(localStream => {
// https://webrtc.org/getting-started/remote-streams
localStream.getTracks().forEach(track => pc.addTrack(track, localStream))
})
I was not able to get any 'track' event. Even when I did overwrite or hook within:
this._pc.ontrack = event => { this._onTrack(event) }
Does anyone have a solution for this problem?
The text was updated successfully, but these errors were encountered: