From 1fee7acaabfb03b31d894ed9fc5a8efb55320896 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Sun, 7 Feb 2021 16:28:09 +0100 Subject: [PATCH] add webrtc_stats to state. --- src/component/main.vue | 3 ++- src/component/types/state.ts | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/component/main.vue b/src/component/main.vue index 79c42ee9..25183d6f 100644 --- a/src/component/main.vue +++ b/src/component/main.vue @@ -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') diff --git a/src/component/types/state.ts b/src/component/types/state.ts index 3cdf29ac..fd710a8d 100644 --- a/src/component/types/state.ts +++ b/src/component/types/state.ts @@ -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 /////////////////////////////