Browse Source

Add a small info box if no sound is detected from the microphone

pull/1082/head
Timothée Jaussoin 3 years ago
parent
commit
1a595eaee6
  1. 4
      app/widgets/VisioConfig/locales.ini
  2. 9
      app/widgets/VisioConfig/visioconfig.css
  3. 32
      app/widgets/VisioConfig/visioconfig.js
  4. 9
      app/widgets/VisioConfig/visioconfig.tpl
  5. 40
      composer.lock

4
app/widgets/VisioConfig/locales.ini

@ -7,4 +7,6 @@ microphone_label= Default microphone
camera = Camera
camera_label = Default camera
default_microphone_changed = Default microphone changed
default_camera_changed = Default camera changed
default_camera_changed = Default camera changed
no_mic_sound = "Movim doesn't detect any sound coming from the microphone"
no_mic_sound2 = "Try to select another source or check your system settings"

9
app/widgets/VisioConfig/visioconfig.css

@ -33,11 +33,16 @@
min-height: 30rem;
}
#visioconfig_widget #no_mic_sound {
animation: fadein 0.3s;
}
#visioconfig_widget #camera_preview.enabled video {
display: initial;
}
#visioconfig_widget #camera_preview video,
#visioconfig_widget #camera_preview.enabled ul.list {
#visioconfig_widget #camera_preview.enabled ul.list,
#visioconfig_widget #no_mic_sound.disabled {
display: none;
}
}

32
app/widgets/VisioConfig/visioconfig.js

@ -7,7 +7,6 @@ var VisioConfig = {
},
gotDevices: function (deviceInfos) {
console.log(deviceInfos);
let microphoneSelect = document.querySelector('select[name=default_microphone]');
microphoneSelect.addEventListener('change', VisioConfig.changeDefaultMicrophone);
microphoneSelect.innerText = '';
@ -85,10 +84,13 @@ var VisioConfig = {
VisioConfig.audioContext = new AudioContext();
let microphone = VisioConfig.audioContext.createMediaStreamSource(stream);
var javascriptNode = VisioConfig.audioContext.createScriptProcessor(2048, 1, 1);
let noMicSound = document.querySelector('#visioconfig_widget #no_mic_sound');
microphone.connect(javascriptNode);
javascriptNode.connect(VisioConfig.audioContext.destination);
isMuteStep = 0;
javascriptNode.onaudioprocess = function(event) {
var inpt = event.inputBuffer.getChannelData(0);
var instant = 0.0;
@ -105,15 +107,27 @@ var VisioConfig = {
let step = 0;
document.querySelectorAll('.level span').forEach(span => {
if (step < Math.floor(level * 10)) {
span.classList.remove('disabled');
} else {
span.classList.add('disabled');
}
if (level == 0) {
isMuteStep++;
} else {
isMuteStep = 0;
}
if (isMuteStep > 50) {
noMicSound.classList.remove('disabled');
} else {
noMicSound.classList.add('disabled');
step++;
});
document.querySelectorAll('.level span').forEach(span => {
if (step < Math.floor(level * 10)) {
span.classList.remove('disabled');
} else {
span.classList.add('disabled');
}
step++;
});
}
}
})
.catch(function (err) {

9
app/widgets/VisioConfig/visioconfig.tpl

@ -47,6 +47,15 @@
<span class="color red"></span>
</div>
</li>
<li id="no_mic_sound" class="disabled">
<span class="primary icon small red">
<i class="material-icons">mic_none</i>
</span>
<div>
<p>{$c->__('visioconfig.no_mic_sound')}</p>
<p>{$c->__('visioconfig.no_mic_sound2')}</p>
</div>
</li>
</ul>
<ul class="list">
<li class="subheader">

40
composer.lock

@ -806,16 +806,16 @@
},
{
"name": "doctrine/dbal",
"version": "3.3.7",
"version": "3.4.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/dbal.git",
"reference": "9f79d4650430b582f4598fe0954ef4d52fbc0a8a"
"reference": "118a360e9437e88d49024f36283c8bcbd76105f5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/9f79d4650430b582f4598fe0954ef4d52fbc0a8a",
"reference": "9f79d4650430b582f4598fe0954ef4d52fbc0a8a",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/118a360e9437e88d49024f36283c8bcbd76105f5",
"reference": "118a360e9437e88d49024f36283c8bcbd76105f5",
"shasum": ""
},
"require": {
@ -823,21 +823,21 @@
"doctrine/cache": "^1.11|^2.0",
"doctrine/deprecations": "^0.5.3|^1",
"doctrine/event-manager": "^1.0",
"php": "^7.3 || ^8.0",
"php": "^7.4 || ^8.0",
"psr/cache": "^1|^2|^3",
"psr/log": "^1|^2|^3"
},
"require-dev": {
"doctrine/coding-standard": "9.0.0",
"jetbrains/phpstorm-stubs": "2022.1",
"phpstan/phpstan": "1.7.13",
"phpstan/phpstan-strict-rules": "^1.2",
"phpunit/phpunit": "9.5.20",
"psalm/plugin-phpunit": "0.16.1",
"squizlabs/php_codesniffer": "3.7.0",
"symfony/cache": "^5.2|^6.0",
"symfony/console": "^2.7|^3.0|^4.0|^5.0|^6.0",
"vimeo/psalm": "4.23.0"
"phpstan/phpstan": "1.8.2",
"phpstan/phpstan-strict-rules": "^1.3",
"phpunit/phpunit": "9.5.21",
"psalm/plugin-phpunit": "0.17.0",
"squizlabs/php_codesniffer": "3.7.1",
"symfony/cache": "^5.4|^6.0",
"symfony/console": "^4.4|^5.4|^6.0",
"vimeo/psalm": "4.24.0"
},
"suggest": {
"symfony/console": "For helpful console commands such as SQL execution and import of files."
@ -897,7 +897,7 @@
],
"support": {
"issues": "https://github.com/doctrine/dbal/issues",
"source": "https://github.com/doctrine/dbal/tree/3.3.7"
"source": "https://github.com/doctrine/dbal/tree/3.4.0"
},
"funding": [
{
@ -913,7 +913,7 @@
"type": "tidelift"
}
],
"time": "2022-06-13T21:43:03+00:00"
"time": "2022-08-06T20:35:57+00:00"
},
{
"name": "doctrine/deprecations",
@ -2801,16 +2801,16 @@
},
{
"name": "nesbot/carbon",
"version": "2.60.0",
"version": "2.61.0",
"source": {
"type": "git",
"url": "https://github.com/briannesbitt/Carbon.git",
"reference": "00a259ae02b003c563158b54fb6743252b638ea6"
"reference": "bdf4f4fe3a3eac4de84dbec0738082a862c68ba6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/00a259ae02b003c563158b54fb6743252b638ea6",
"reference": "00a259ae02b003c563158b54fb6743252b638ea6",
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/bdf4f4fe3a3eac4de84dbec0738082a862c68ba6",
"reference": "bdf4f4fe3a3eac4de84dbec0738082a862c68ba6",
"shasum": ""
},
"require": {
@ -2899,7 +2899,7 @@
"type": "tidelift"
}
],
"time": "2022-07-27T15:57:48+00:00"
"time": "2022-08-06T12:41:24+00:00"
},
{
"name": "nette/schema",

Loading…
Cancel
Save