You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by so...@apache.org on 2020/12/17 04:05:31 UTC

[openmeetings] branch master updated: [OPENMEETINGS-2539] mic level being displayed as expected

This is an automated email from the ASF dual-hosted git repository.

solomax pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openmeetings.git


The following commit(s) were added to refs/heads/master by this push:
     new 7979b33  [OPENMEETINGS-2539] mic level being displayed as expected
7979b33 is described below

commit 7979b334b518f29d9ae0a258813f42a932611487
Author: Maxim Solodovnik <so...@gmail.com>
AuthorDate: Thu Dec 17 11:05:14 2020 +0700

    [OPENMEETINGS-2539] mic level being displayed as expected
---
 .../apache/openmeetings/web/room/raw-settings.js   | 34 ++++++++++++----------
 1 file changed, 18 insertions(+), 16 deletions(-)

diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/raw-settings.js b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/raw-settings.js
index c3b2be0..1019f4f 100644
--- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/raw-settings.js
+++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/raw-settings.js
@@ -64,22 +64,24 @@ var MicLevel = (function() {
 				const WIDTH = canvas.width
 					, HEIGHT = canvas.height;
 				canvasCtx.clearRect(0, 0, WIDTH, HEIGHT);
-				if (!!analyser && cnvs.is(':visible')) {
-					analyser.getByteFrequencyData(arr);
-					let favg = 0.0;
-					for (let i = 0; i < al; ++i) {
-						favg += arr[i] * arr[i];
-					}
-					vol = Math.sqrt(favg / al);
-					vals.push(vol);
-					const min = vals.min();
-					_micActivity(vol > min + 5); // magic number
-					canvasCtx.fillStyle = color;
-					if (horiz) {
-						canvasCtx.fillRect(0, 0, WIDTH * vol / 100, HEIGHT);
-					} else {
-						const h = HEIGHT * vol / 100;
-						canvasCtx.fillRect(0, HEIGHT - h, WIDTH, h);
+				if (!!analyser && cnvs.length > 0) {
+					if (cnvs.is(':visible')) {
+						analyser.getByteFrequencyData(arr);
+						let favg = 0.0;
+						for (let i = 0; i < al; ++i) {
+							favg += arr[i] * arr[i];
+						}
+						vol = Math.sqrt(favg / al);
+						vals.push(vol);
+						const min = vals.min();
+						_micActivity(vol > min + 5); // magic number
+						canvasCtx.fillStyle = color;
+						if (horiz) {
+							canvasCtx.fillRect(0, 0, WIDTH * vol / 100, HEIGHT);
+						} else {
+							const h = HEIGHT * vol / 100;
+							canvasCtx.fillRect(0, HEIGHT - h, WIDTH, h);
+						}
 					}
 					requestAnimationFrame(update);
 				}