1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-12-01 04:43:29 +03:00

Make sure to callLengthInterval only once

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner
2021-09-29 15:46:22 +02:00
parent 92f7ddcf3e
commit b4bc554d7a

View File

@@ -1572,10 +1572,13 @@ export class MatrixCall extends EventEmitter {
// chrome doesn't implement any of the 'onstarted' events yet
if (this.peerConn.iceConnectionState == 'connected') {
this.setState(CallState.Connected);
if (!this.callLengthInterval) {
this.callLengthInterval = setInterval(() => {
this.callLength++;
this.emit(CallEvent.LengthChanged, this.callLength);
}, 1000);
}
} else if (this.peerConn.iceConnectionState == 'failed') {
this.hangup(CallErrorCode.IceFailed, false);
}