You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-26 17:03:12 +03:00
Check TURN servers periodically, and at start of calls
Hopefully this should make our turn-credential checking code a bit more robust (and possibly fix a seconds / ms mismatch).
This commit is contained in:
@@ -527,6 +527,13 @@ export class MatrixCall extends EventEmitter {
|
||||
const invite = event.getContent();
|
||||
this.direction = CallDirection.Inbound;
|
||||
|
||||
// make sure we have valid turn creds. Unless something's gone wrong, it should
|
||||
// poll and keep the credentials valid so this should be instant.
|
||||
const haveTurnCreds = await this.client._checkTurnServers();
|
||||
if (!haveTurnCreds) {
|
||||
logger.warn("Failed to get TURN credentials! Proceeding with call anyway...");
|
||||
}
|
||||
|
||||
this.peerConn = this.createPeerConnection();
|
||||
// we must set the party ID before await-ing on anything: the call event
|
||||
// handler will start giving us more call events (eg. candidates) so if
|
||||
@@ -1662,6 +1669,14 @@ export class MatrixCall extends EventEmitter {
|
||||
this.setState(CallState.WaitLocalMedia);
|
||||
this.direction = CallDirection.Outbound;
|
||||
this.config = constraints;
|
||||
|
||||
// make sure we have valid turn creds. Unless something's gone wrong, it should
|
||||
// poll and keep the credentials valid so this should be instant.
|
||||
const haveTurnCreds = await this.client._checkTurnServers();
|
||||
if (!haveTurnCreds) {
|
||||
logger.warn("Failed to get TURN credentials! Proceeding with call anyway...");
|
||||
}
|
||||
|
||||
// It would be really nice if we could start gathering candidates at this point
|
||||
// so the ICE agent could be gathering while we open our media devices: we already
|
||||
// know the type of the call and therefore what tracks we want to send.
|
||||
|
||||
Reference in New Issue
Block a user