hardcode turn server for now
This commit is contained in:
parent
797cb23cc7
commit
2635adb232
4 changed files with 11 additions and 5 deletions
|
@ -96,6 +96,10 @@ export class Session {
|
||||||
ownDeviceId: sessionInfo.deviceId,
|
ownDeviceId: sessionInfo.deviceId,
|
||||||
ownUserId: sessionInfo.userId,
|
ownUserId: sessionInfo.userId,
|
||||||
logger: this._platform.logger,
|
logger: this._platform.logger,
|
||||||
|
turnServers: [{
|
||||||
|
urls: ["stun:turn.matrix.org"],
|
||||||
|
}],
|
||||||
|
forceTURN: false,
|
||||||
});
|
});
|
||||||
this._deviceMessageHandler = new DeviceMessageHandler({storage, callHandler: this._callHandler});
|
this._deviceMessageHandler = new DeviceMessageHandler({storage, callHandler: this._callHandler});
|
||||||
this._olm = olm;
|
this._olm = olm;
|
||||||
|
|
|
@ -45,6 +45,8 @@ import type {
|
||||||
|
|
||||||
export type Options = {
|
export type Options = {
|
||||||
webRTC: WebRTC,
|
webRTC: WebRTC,
|
||||||
|
forceTURN: boolean,
|
||||||
|
turnServers: RTCIceServer[],
|
||||||
createTimeout: TimeoutCreator,
|
createTimeout: TimeoutCreator,
|
||||||
emitUpdate: (peerCall: PeerCall, params: any) => void;
|
emitUpdate: (peerCall: PeerCall, params: any) => void;
|
||||||
sendSignallingMessage: (message: SignallingMessage<MCallBase>, log: ILogItem) => Promise<void>;
|
sendSignallingMessage: (message: SignallingMessage<MCallBase>, log: ILogItem) => Promise<void>;
|
||||||
|
@ -132,7 +134,7 @@ export class PeerCall implements IDisposable {
|
||||||
getPurposeForStreamId(streamId: string): SDPStreamMetadataPurpose {
|
getPurposeForStreamId(streamId: string): SDPStreamMetadataPurpose {
|
||||||
return outer.remoteSDPStreamMetadata?.[streamId]?.purpose ?? SDPStreamMetadataPurpose.Usermedia;
|
return outer.remoteSDPStreamMetadata?.[streamId]?.purpose ?? SDPStreamMetadataPurpose.Usermedia;
|
||||||
}
|
}
|
||||||
});
|
}, this.options.forceTURN, this.options.turnServers, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
get dataChannel(): any | undefined { return this._dataChannel; }
|
get dataChannel(): any | undefined { return this._dataChannel; }
|
||||||
|
|
|
@ -18,7 +18,7 @@ import {Track, TrackType} from "./MediaDevices";
|
||||||
import {SDPStreamMetadataPurpose} from "../../matrix/calls/callEventTypes";
|
import {SDPStreamMetadataPurpose} from "../../matrix/calls/callEventTypes";
|
||||||
|
|
||||||
export interface WebRTC {
|
export interface WebRTC {
|
||||||
createPeerConnection(handler: PeerConnectionHandler): PeerConnection;
|
createPeerConnection(handler: PeerConnectionHandler, forceTURN: boolean, turnServers: RTCIceServer[], iceCandidatePoolSize): PeerConnection;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PeerConnectionHandler {
|
export interface PeerConnectionHandler {
|
||||||
|
|
|
@ -24,8 +24,8 @@ export const SPEAKING_THRESHOLD = -60; // dB
|
||||||
const SPEAKING_SAMPLE_COUNT = 8; // samples
|
const SPEAKING_SAMPLE_COUNT = 8; // samples
|
||||||
|
|
||||||
export class DOMWebRTC implements WebRTC {
|
export class DOMWebRTC implements WebRTC {
|
||||||
createPeerConnection(handler: PeerConnectionHandler): PeerConnection {
|
createPeerConnection(handler: PeerConnectionHandler, forceTURN: boolean, turnServers: RTCIceServer[], iceCandidatePoolSize): PeerConnection {
|
||||||
return new DOMPeerConnection(handler, false, []);
|
return new DOMPeerConnection(handler, forceTURN, turnServers, iceCandidatePoolSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ class DOMPeerConnection implements PeerConnection {
|
||||||
//private dataChannelWrapper?: DOMDataChannel;
|
//private dataChannelWrapper?: DOMDataChannel;
|
||||||
private _remoteTracks: TrackWrapper[] = [];
|
private _remoteTracks: TrackWrapper[] = [];
|
||||||
|
|
||||||
constructor(handler: PeerConnectionHandler, forceTURN: boolean, turnServers: RTCIceServer[], iceCandidatePoolSize = 0) {
|
constructor(handler: PeerConnectionHandler, forceTURN: boolean, turnServers: RTCIceServer[], iceCandidatePoolSize) {
|
||||||
this.handler = handler;
|
this.handler = handler;
|
||||||
this.peerConnection = new RTCPeerConnection({
|
this.peerConnection = new RTCPeerConnection({
|
||||||
iceTransportPolicy: forceTURN ? 'relay' : undefined,
|
iceTransportPolicy: forceTURN ? 'relay' : undefined,
|
||||||
|
|
Reference in a new issue