webrtcReconnect.

This commit is contained in:
Miroslav Šedivý 2021-02-08 22:32:54 +01:00
parent 15e369da33
commit e28b714090

View File

@ -397,6 +397,8 @@
Vue.set(this.state.connection, 'type', 'webrtc') Vue.set(this.state.connection, 'type', 'webrtc')
this.events.emit('connection.webrtc', 'connected') this.events.emit('connection.webrtc', 'connected')
}) })
let webrtcReconnect: any
this.webrtc.on('disconnected', () => { this.webrtc.on('disconnected', () => {
Vue.set(this.state.connection.webrtc, 'status', 'disconnected') Vue.set(this.state.connection.webrtc, 'status', 'disconnected')
Vue.set(this.state.connection.webrtc, 'stats', null) Vue.set(this.state.connection.webrtc, 'stats', null)
@ -417,7 +419,9 @@
// reconnect WebRTC // reconnect WebRTC
if (this.connected) { if (this.connected) {
setTimeout(() => { if (webrtcReconnect) clearTimeout(webrtcReconnect)
webrtcReconnect = setTimeout(() => {
try { try {
this.webrtcConnect() this.webrtcConnect()
} catch (e) {} } catch (e) {}