add webrtc_stats to state.

This commit is contained in:
Miroslav Šedivý 2021-02-07 16:28:09 +01:00
parent 0aef325c5b
commit 1fee7acaab
2 changed files with 11 additions and 1 deletions

View File

@ -86,6 +86,7 @@
authenticated: false,
websocket: this.websocket.supported ? 'disconnected' : 'unavailable',
webrtc: this.webrtc.supported ? 'disconnected' : 'unavailable',
webrtc_stats: null,
type: 'none',
},
video: {
@ -363,7 +364,7 @@
this.websocket.send('signal/candidate', candidate)
})
this.webrtc.on('stats', (stats: WebRTCStats) => {
console.log(stats)
Vue.set(this.state.connection, 'webrtc_stats', stats)
})
this.webrtc.on('connecting', () => {
Vue.set(this.state.connection, 'webrtc', 'connecting')

View File

@ -14,9 +14,18 @@ export interface Connection {
authenticated: boolean
websocket: 'unavailable' | 'disconnected' | 'connecting' | 'connected'
webrtc: 'unavailable' | 'disconnected' | 'connecting' | 'connected'
webrtc_stats: WebRTCStats | null
type: 'webrtc' | 'fallback' | 'none'
}
export interface WebRTCStats {
bitrate: number
packetLoss: number
fps: number
width: number
height: number
}
/////////////////////////////
// Video
/////////////////////////////