I am trying to develop a fork of JsSIP that is compatible with Node.js using node-webrtc, and I've hit a road block.
In my code, I also attempt to clone the track to see if that would solve the problem which it also does not.
Here is my code (context):
for (let i of stream.getTracks()) {
let trackClone = i.clone();
console.log(i, trackClone, i.constructor, MediaStreamTrack, i.constructor == MediaStreamTrack, i instanceof MediaStreamTrack, stream, stream.getTracks());
console.log(i instanceof MediaStream);
this._connection.addTrack(trackClone, stream);
}
Expected result in console:
MediaStreamTrack {} MediaStreamTrack {} [Function: MediaStreamTrack] [Function: MediaStreamTrack] true true MediaStream {} [ MediaStreamTrack {} ]
true
Actual result in console:
MediaStreamTrack {} MediaStreamTrack {} [Function: MediaStreamTrack] [Function: MediaStreamTrack] false false MediaStream {} [ MediaStreamTrack {} ]
false
This is a problem, because RTCPeerConnection.addTrack() does not work on these fake "tracks" or the fake stream.
I think it might be a problem with the stream transferring between files, as before it is passed into this function, stream instanceof MediaStream = true.