Closed ibc closed 6 months ago
Actually I'm gonna close this task. Despite mediasoup-client can work in Node it heavily rely on WebRTC API. For example, Producer.ts
depends on many "dom" types such as MediaStreamTrack
, RTCRtpSender
, etc:
/**
* Associated RTCRtpSender.
*/
get rtpSender(): RTCRtpSender | undefined {
return this._rtpSender;
}
/**
* The associated track.
*/
get track(): MediaStreamTrack | null {
return this._track;
}
We cannot replace them with "abstract" types because they are what they are.
The thing is that, when running in Node, the mediasoup-client handler (such as mediasoup-client-aiortc) must be ready to handle and produce objects with those types.
In
tsconfig.json
we rely on "dom" TS library. We do it because we need definition ofRTCPeerConnection
,MediaStream
and tons of things only available in browser.However we also want that mediasoup-client runs in Node (by using mediasoup-client-aiortc for example). And it's a bad idea to use DOM TS types in a lib intended (also) for Node. So:
tsconfig.json
.RTCStatsReport
. We can makegetStats()
methods returnReturnType<xxx>
. Well, not sure if this is doable.ReturnType
of what?