we can assume setConfiguration is available

This commit is contained in:
Bruno Windels 2022-09-26 15:45:41 +02:00
parent d36b9be24f
commit ac319bdafd
2 changed files with 6 additions and 7 deletions

View File

@ -120,13 +120,11 @@ export class PeerCall implements IDisposable {
[this.options.turnServer.get()],
0
);
// update turn servers when they change (see TurnServerSource) if possible
if (typeof this.peerConnection["setConfiguration"] === "function") {
this.disposables.track(this.options.turnServer.subscribe(turnServer => {
this.logItem.log({l: "updating turn server", turnServer})
this.peerConnection["setConfiguration"]({iceServers: [turnServer]});
}));
}
// update turn servers when they change (see TurnServerSource)
this.disposables.track(this.options.turnServer.subscribe(turnServer => {
this.logItem.log({l: "updating turn server", turnServer})
this.peerConnection.setConfiguration({iceServers: [turnServer]});
}));
const listen = <K extends keyof PeerConnectionEventMap>(type: K, listener: (this: PeerConnection, ev: PeerConnectionEventMap[K]) => any, options?: boolean | EventListenerOptions): void => {
this.peerConnection.addEventListener(type, listener);
const dispose = () => {

View File

@ -148,6 +148,7 @@ export interface PeerConnection {
addEventListener<K extends keyof PeerConnectionEventMap>(type: K, listener: (this: PeerConnection, ev: PeerConnectionEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
removeEventListener<K extends keyof PeerConnectionEventMap>(type: K, listener: (this: PeerConnection, ev: PeerConnectionEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
getStats(selector?: Track | null): Promise<StatsReport>;
setConfiguration(configuration?: RTCConfiguration): void;
}