hardcode turn server for now

This commit is contained in:
Bruno Windels 2022-04-12 14:02:38 +02:00
parent 797cb23cc7
commit 2635adb232
4 changed files with 11 additions and 5 deletions

View file

@ -96,6 +96,10 @@ export class Session {
ownDeviceId: sessionInfo.deviceId,
ownUserId: sessionInfo.userId,
logger: this._platform.logger,
turnServers: [{
urls: ["stun:turn.matrix.org"],
}],
forceTURN: false,
});
this._deviceMessageHandler = new DeviceMessageHandler({storage, callHandler: this._callHandler});
this._olm = olm;

View file

@ -45,6 +45,8 @@ import type {
export type Options = {
webRTC: WebRTC,
forceTURN: boolean,
turnServers: RTCIceServer[],
createTimeout: TimeoutCreator,
emitUpdate: (peerCall: PeerCall, params: any) => void;
sendSignallingMessage: (message: SignallingMessage<MCallBase>, log: ILogItem) => Promise<void>;
@ -132,7 +134,7 @@ export class PeerCall implements IDisposable {
getPurposeForStreamId(streamId: string): SDPStreamMetadataPurpose {
return outer.remoteSDPStreamMetadata?.[streamId]?.purpose ?? SDPStreamMetadataPurpose.Usermedia;
}
});
}, this.options.forceTURN, this.options.turnServers, 0);
}
get dataChannel(): any | undefined { return this._dataChannel; }

View file

@ -18,7 +18,7 @@ import {Track, TrackType} from "./MediaDevices";
import {SDPStreamMetadataPurpose} from "../../matrix/calls/callEventTypes";
export interface WebRTC {
createPeerConnection(handler: PeerConnectionHandler): PeerConnection;
createPeerConnection(handler: PeerConnectionHandler, forceTURN: boolean, turnServers: RTCIceServer[], iceCandidatePoolSize): PeerConnection;
}
export interface PeerConnectionHandler {

View file

@ -24,8 +24,8 @@ export const SPEAKING_THRESHOLD = -60; // dB
const SPEAKING_SAMPLE_COUNT = 8; // samples
export class DOMWebRTC implements WebRTC {
createPeerConnection(handler: PeerConnectionHandler): PeerConnection {
return new DOMPeerConnection(handler, false, []);
createPeerConnection(handler: PeerConnectionHandler, forceTURN: boolean, turnServers: RTCIceServer[], iceCandidatePoolSize): PeerConnection {
return new DOMPeerConnection(handler, forceTURN, turnServers, iceCandidatePoolSize);
}
}
@ -35,7 +35,7 @@ class DOMPeerConnection implements PeerConnection {
//private dataChannelWrapper?: DOMDataChannel;
private _remoteTracks: TrackWrapper[] = [];
constructor(handler: PeerConnectionHandler, forceTURN: boolean, turnServers: RTCIceServer[], iceCandidatePoolSize = 0) {
constructor(handler: PeerConnectionHandler, forceTURN: boolean, turnServers: RTCIceServer[], iceCandidatePoolSize) {
this.handler = handler;
this.peerConnection = new RTCPeerConnection({
iceTransportPolicy: forceTURN ? 'relay' : undefined,