Highlight talking user

This commit is contained in:
Pierre HUBERT 2021-01-23 20:56:07 +01:00
parent 393da5beaf
commit e5c4a87a4f
2 changed files with 15 additions and 2 deletions

View File

@ -98,6 +98,11 @@
color: rgb(1, 218, 1); color: rgb(1, 218, 1);
} }
.call-window .members-area span.talking {
font-weight: bold;
text-decoration: underline;
}
.call-window .messages-area { .call-window .messages-area {
color: white; color: white;
margin: 1px 10px; margin: 1px 10px;

View File

@ -793,6 +793,8 @@ class CallWindow extends CustomEvents {
const freq_data = new Uint8Array(analyzer_node.frequencyBinCount) const freq_data = new Uint8Array(analyzer_node.frequencyBinCount)
const memberEl = this.getMemberNameEl(peerID);
script_processor_analysis_node.onaudioprocess = function(e) { script_processor_analysis_node.onaudioprocess = function(e) {
analyzer_node.getByteFrequencyData(freq_data); analyzer_node.getByteFrequencyData(freq_data);
@ -807,7 +809,11 @@ class CallWindow extends CustomEvents {
const avg = sum/count; const avg = sum/count;
console.log(avg > 50); if(avg > 50)
memberEl.classList.add("talking")
else
memberEl.classList.remove("talking");
} }
audioContext.addEventListener("statechange", e => { audioContext.addEventListener("statechange", e => {
@ -818,6 +824,8 @@ class CallWindow extends CustomEvents {
script_processor_analysis_node.disconnect(); script_processor_analysis_node.disconnect();
microphone_stream.disconnect(); microphone_stream.disconnect();
analyzer_node.disconnect(); analyzer_node.disconnect();
memberEl.classList.remove("talking")
} }
}) })