speaker-calibration 2.2.163 → 2.2.164
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/example/i18n.js +1773 -1554
- package/dist/example/listener.html +9 -2
- package/dist/example/listener.js +20 -3
- package/dist/example/styles.css +5 -2
- package/dist/main.js +3 -3
- package/package.json +1 -1
- package/src/peer-connection/speaker.js +0 -1
- package/src/tasks/combination/combination.js +20 -29
|
@@ -39,8 +39,15 @@
|
|
|
39
39
|
<h1>Sound Calibration</h1>
|
|
40
40
|
<p class="lead" id="allowMicrophone"></p>
|
|
41
41
|
<p class="lead" id="message"></p>
|
|
42
|
-
<div class="col-6">
|
|
43
|
-
<button
|
|
42
|
+
<div class="col-6" , style="cursor: pointer">
|
|
43
|
+
<button
|
|
44
|
+
id="calibrationBeginButton"
|
|
45
|
+
type="button"
|
|
46
|
+
class="btn btn-success"
|
|
47
|
+
style="cursor: pointer"
|
|
48
|
+
>
|
|
49
|
+
Proceed
|
|
50
|
+
</button>
|
|
44
51
|
</div>
|
|
45
52
|
</div>
|
|
46
53
|
<div id="updateDisplay">
|
package/dist/example/listener.js
CHANGED
|
@@ -15,9 +15,12 @@ const listenerParameters = {
|
|
|
15
15
|
const container = document.getElementById('listenerContainer');
|
|
16
16
|
const recordingInProgress = phrases.RC_soundRecording['en-US'];
|
|
17
17
|
const backToExperimentWindow = phrases.RC_backToExperimentWindow['en-US'];
|
|
18
|
-
const allowMicrophone = phrases.RC_allowMicrophoneUse['en-US'];
|
|
19
|
-
const placeSmartphoneMicrophone = phrases.RC_placeSmartphoneMicrophone['en-US']
|
|
20
|
-
|
|
18
|
+
const allowMicrophone = phrases.RC_allowMicrophoneUse['en-US'].replace(/\n/g, '<br>');
|
|
19
|
+
const placeSmartphoneMicrophone = phrases.RC_placeSmartphoneMicrophone['en-US'].replace(
|
|
20
|
+
/\n/g,
|
|
21
|
+
'<br>'
|
|
22
|
+
);
|
|
23
|
+
const turnMeToReadBelow = phrases.RC_turnMeToReadBelow['en-US'].replace(/\n/g, '<br>');
|
|
21
24
|
const recordingInProgressElement = document.getElementById('recordingInProgress');
|
|
22
25
|
const allowMicrophoneElement = document.getElementById('allowMicrophone');
|
|
23
26
|
const turnMessageElement = document.getElementById('turnMeToReadBelow');
|
|
@@ -25,7 +28,11 @@ const turnMessageElement = document.getElementById('turnMeToReadBelow');
|
|
|
25
28
|
switch (isSmartPhone) {
|
|
26
29
|
case 'true':
|
|
27
30
|
allowMicrophoneElement.innerHTML = placeSmartphoneMicrophone;
|
|
31
|
+
allowMicrophoneElement.style.lineHeight = '1.2rem';
|
|
32
|
+
allowMicrophoneElement.style.fontSize = '14px';
|
|
28
33
|
turnMessageElement.innerHTML = turnMeToReadBelow;
|
|
34
|
+
turnMessageElement.style.lineHeight = '1.2rem';
|
|
35
|
+
turnMessageElement.style.fontSize = '14px';
|
|
29
36
|
// show the html upsidedown
|
|
30
37
|
const phrasesContainer = document.getElementById('phrases');
|
|
31
38
|
// add class
|
|
@@ -37,7 +44,11 @@ switch (isSmartPhone) {
|
|
|
37
44
|
container.style.display = 'block';
|
|
38
45
|
// event listener for id calibrationBeginButton
|
|
39
46
|
const calibrationBeginButton = document.getElementById('calibrationBeginButton');
|
|
47
|
+
console.log('Waiting for proceed button click');
|
|
48
|
+
|
|
40
49
|
calibrationBeginButton.addEventListener('click', async () => {
|
|
50
|
+
console.log('Proceed button clicked');
|
|
51
|
+
|
|
41
52
|
// remove the button
|
|
42
53
|
calibrationBeginButton.remove();
|
|
43
54
|
// remove turn message
|
|
@@ -53,15 +64,20 @@ switch (isSmartPhone) {
|
|
|
53
64
|
let fontSize = 100;
|
|
54
65
|
recordingInProgressElement.style.fontSize = fontSize + 'px';
|
|
55
66
|
|
|
67
|
+
console.log('Adjusting font size for recording in progress text');
|
|
56
68
|
while (recordingInProgressElement.scrollWidth > window.innerWidth * 0.9 && fontSize > 10) {
|
|
57
69
|
fontSize--;
|
|
58
70
|
recordingInProgressElement.style.fontSize = fontSize + 'px';
|
|
59
71
|
}
|
|
72
|
+
console.log('Done adjusting font size for recording in progress text');
|
|
60
73
|
const webAudioDeviceNames = {microphone: '', deviceID: ''};
|
|
61
74
|
const externalMicList = ['UMIK', 'Airpods', 'Bluetooth'];
|
|
62
75
|
try {
|
|
76
|
+
console.log('Getting user media...Should ask for microphone permission');
|
|
63
77
|
const stream = await navigator.mediaDevices.getUserMedia({audio: true});
|
|
78
|
+
console.log('Got user media');
|
|
64
79
|
if (stream) {
|
|
80
|
+
console.log('Getting devices');
|
|
65
81
|
const devices = await navigator.mediaDevices.enumerateDevices();
|
|
66
82
|
console.log(devices);
|
|
67
83
|
const mics = devices.filter(device => device.kind === 'audioinput');
|
|
@@ -90,6 +106,7 @@ switch (isSmartPhone) {
|
|
|
90
106
|
console.log(err);
|
|
91
107
|
}
|
|
92
108
|
console.log(lock);
|
|
109
|
+
console.log('Starting Calibration');
|
|
93
110
|
window.listener = new speakerCalibrator.Listener(listenerParameters);
|
|
94
111
|
console.log(window.listener);
|
|
95
112
|
if (lock) {
|
package/dist/example/styles.css
CHANGED
|
@@ -47,6 +47,7 @@ hr {
|
|
|
47
47
|
right: 10px;
|
|
48
48
|
overflow-y: scroll;
|
|
49
49
|
max-height: 70vh;
|
|
50
|
+
z-index: 1000;
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
.updateDisplay {
|
|
@@ -56,14 +57,16 @@ hr {
|
|
|
56
57
|
right: 10px; */
|
|
57
58
|
overflow-y: scroll;
|
|
58
59
|
overflow-x: hidden;
|
|
60
|
+
z-index: 1;
|
|
59
61
|
}
|
|
60
62
|
|
|
61
63
|
.turnMeToReadBelow {
|
|
62
64
|
position: absolute;
|
|
63
65
|
top: 20px;
|
|
64
|
-
font-size: larger;
|
|
65
|
-
max-height: 25vh;
|
|
66
|
+
/* font-size: larger; */
|
|
67
|
+
/* max-height: 25vh; */
|
|
66
68
|
overflow-y: scroll;
|
|
69
|
+
line-height: 1.2rem;
|
|
67
70
|
}
|
|
68
71
|
|
|
69
72
|
#calibrationBeginButton {
|