sendonly track and remove func.

This commit is contained in:
Miroslav Šedivý 2021-12-02 22:37:37 +01:00
parent 9be83e5160
commit fc2979d5ce

View File

@ -211,7 +211,15 @@ export class NekoWebRTC extends EventEmitter<NekoWebRTCEvents> {
throw new Error('attempting to add track for nonexistent peer') throw new Error('attempting to add track for nonexistent peer')
} }
return this._peer.addTrack(track, ...streams) return this._peer.addTransceiver(track, { direction: 'sendonly', streams }).sender
}
public removeTrack(sender: RTCRtpSender) {
if (!this._peer) {
throw new Error('attempting to add track for nonexistent peer')
}
this._peer.removeTrack(sender)
} }
public disconnect() { public disconnect() {