chromium webrtc track workaround.

This commit is contained in:
Miroslav Šedivý 2021-12-12 23:55:43 +01:00
parent f12d77f78f
commit 88886972e2

View File

@ -235,8 +235,16 @@ export class NekoWebRTC extends EventEmitter<NekoWebRTCEvents> {
throw new Error('attempting to add track for nonexistent peer')
}
// @ts-ignore
const isChromium = !!window.chrome
// TOOD: Ugly workaround, find real cause of this issue.
if (isChromium) {
return this._peer.addTrack(track, ...streams)
} else {
return this._peer.addTransceiver(track, { direction: 'sendonly', streams }).sender
}
}
public removeTrack(sender: RTCRtpSender) {
if (!this._peer) {