Skip to content

Commit

Permalink
feat: add prefetching, and use google stun for faster ice gathering
Browse files Browse the repository at this point in the history
  • Loading branch information
farhat-ha committed Apr 5, 2024
1 parent e2a782a commit 8af4ae0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions packages/js/src/Modules/Verto/BrowserSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -612,12 +612,11 @@ export default abstract class BrowserSession extends BaseSession {
}

set iceServers(servers: RTCIceServer[] | boolean) {
const googleStun = { urls: ['stun:stun.l.google.com:19302'] };
if (typeof servers === 'boolean') {
this._iceServers = servers
? [{ urls: ['stun:stun.l.google.com:19302'] }]
: [];
this._iceServers = servers ? [googleStun] : [];
} else {
this._iceServers = servers || [TURN_SERVER, STUN_SERVER];
this._iceServers = servers || [TURN_SERVER, STUN_SERVER, googleStun];
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/js/src/Modules/Verto/webrtc/Peer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ export default class Peer {
}

private handleIceCandidate = (event: RTCPeerConnectionIceEvent) => {
console.log(event.candidate);
if (event.candidate && ['relay', 'srflx'].includes(event.candidate.type)) {
// Found enough candidates to establish a connection
// This is a workaround for the issue where iceGatheringState is always 'gathering'
Expand Down Expand Up @@ -380,6 +379,7 @@ export default class Peer {
const { iceServers = [] } = this.options;

const config: RTCConfiguration = {
iceCandidatePoolSize: 255,
bundlePolicy: 'max-compat',
iceServers,
};
Expand Down

0 comments on commit 8af4ae0

Please sign in to comment.