From e5c4a87a4f62817ad311d6fde2b7edacba004de1 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Sat, 23 Jan 2021 20:56:07 +0100 Subject: [PATCH] Highlight talking user --- assets/css/components/calls/window.css | 5 +++++ assets/js/components/calls/window.js | 12 ++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/assets/css/components/calls/window.css b/assets/css/components/calls/window.css index 164477b4..68cbbe9f 100644 --- a/assets/css/components/calls/window.css +++ b/assets/css/components/calls/window.css @@ -98,6 +98,11 @@ color: rgb(1, 218, 1); } +.call-window .members-area span.talking { + font-weight: bold; + text-decoration: underline; +} + .call-window .messages-area { color: white; margin: 1px 10px; diff --git a/assets/js/components/calls/window.js b/assets/js/components/calls/window.js index 07f1d539..dac502a0 100644 --- a/assets/js/components/calls/window.js +++ b/assets/js/components/calls/window.js @@ -793,7 +793,9 @@ class CallWindow extends CustomEvents { const freq_data = new Uint8Array(analyzer_node.frequencyBinCount) - + const memberEl = this.getMemberNameEl(peerID); + + script_processor_analysis_node.onaudioprocess = function(e) { analyzer_node.getByteFrequencyData(freq_data); @@ -807,7 +809,11 @@ class CallWindow extends CustomEvents { const avg = sum/count; - console.log(avg > 50); + if(avg > 50) + memberEl.classList.add("talking") + else + memberEl.classList.remove("talking"); + } audioContext.addEventListener("statechange", e => { @@ -818,6 +824,8 @@ class CallWindow extends CustomEvents { script_processor_analysis_node.disconnect(); microphone_stream.disconnect(); analyzer_node.disconnect(); + + memberEl.classList.remove("talking") } })