speaker-calibration 2.2.211 → 2.2.213

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "speaker-calibration",
3
- "version": "2.2.211",
3
+ "version": "2.2.213",
4
4
  "description": "Speaker calibration library for auditory testing",
5
5
  "main": "dist/main.js",
6
6
  "directories": {
@@ -31,6 +31,7 @@
31
31
  "license": "MIT",
32
32
  "repository": "git://github.com/EasyEyes/speaker-calibration.git",
33
33
  "dependencies": {
34
+ "@babel/runtime": "^7.26.0",
34
35
  "axios": "^1.6.7",
35
36
  "fftw-js": "^0.1.4",
36
37
  "firebase": "^9.23.0",
@@ -38,7 +39,7 @@
38
39
  "np": "^7.7.0",
39
40
  "nvm": "^0.0.4",
40
41
  "path-browserify": "^1.0.1",
41
- "peerjs": "^1.3.2",
42
+ "peerjs": "1.4.7",
42
43
  "qrcode": "^1.4.4",
43
44
  "socket.io-client": "^4.4.1",
44
45
  "sweetalert2": "^11.14.0",
@@ -46,9 +47,13 @@
46
47
  "xlsx": "^0.18.5"
47
48
  },
48
49
  "devDependencies": {
49
- "@babel/core": "^7.17.9",
50
- "@babel/preset-env": "^7.16.11",
50
+ "@babel/core": "^7.26.0",
51
+ "@babel/plugin-transform-async-to-generator": "^7.25.9",
52
+ "@babel/plugin-transform-runtime": "^7.25.9",
53
+ "@babel/preset-env": "^7.26.0",
54
+ "babel-loader": "^9.2.1",
51
55
  "babel-jest": "^27.5.1",
56
+ "core-js": "^3.40.0",
52
57
  "css-loader": "^5.2.6",
53
58
  "eslint": "^8.10.0",
54
59
  "eslint-config-airbnb-base": "^15.0.0",
@@ -1,5 +1,6 @@
1
1
  // get element with id message
2
- import {phrases} from './i18n.js';
2
+ import {phrases} from '../../dist/example/i18n.js';
3
+ import {Listener} from '../main.js';
3
4
  // get url query parameters
4
5
  const urlParams = new URLSearchParams(window.location.search);
5
6
 
@@ -107,8 +108,8 @@ switch (isSmartPhone) {
107
108
  }
108
109
  console.log(lock);
109
110
  console.log('Starting Calibration');
110
- console.log('Device id in example listenr:',listenerParameters.microphoneDeviceId);
111
- window.listener = new speakerCalibrator.Listener(listenerParameters);
111
+ console.log('Device id in example listenr:', listenerParameters.microphoneDeviceId);
112
+ window.listener = new Listener(listenerParameters);
112
113
  console.log(window.listener);
113
114
  if (lock) {
114
115
  lock.release();
@@ -121,7 +122,7 @@ switch (isSmartPhone) {
121
122
  calibrationBeginButton2.remove();
122
123
  container.style.display = 'block';
123
124
  // event listener for when the page is loaded
124
-
125
+
125
126
  window.addEventListener('load', () => {
126
127
  // set the text of the html elements
127
128
  recordingInProgressElement.innerHTML = recordingInProgress;
@@ -145,7 +146,7 @@ switch (isSmartPhone) {
145
146
  p.innerHTML = backToExperimentWindow;
146
147
  message.appendChild(p);
147
148
  listenerParameters.microphoneDeviceId = urlParams.get('deviceId');
148
- window.listener = new speakerCalibrator.Listener(listenerParameters);
149
+ window.listener = new Listener(listenerParameters);
149
150
  console.log(window.listener);
150
151
  });
151
152
  break;
@@ -161,8 +161,8 @@ class Listener extends AudioPeer {
161
161
  };
162
162
 
163
163
  getDeviceInfo = async () => {
164
+ const deviceInfo = {};
164
165
  try {
165
- const deviceInfo = {};
166
166
  fod.complete(function (data) {
167
167
  deviceInfo['IsMobile'] = data.device['ismobile'];
168
168
  deviceInfo['HardwareName'] = data.device['hardwarename'];
@@ -176,21 +176,20 @@ class Listener extends AudioPeer {
176
176
  deviceInfo['DeviceType'] = data.device['devicetype'];
177
177
  // deviceInfo['deviceInfoFromUser'] = this.deviceInfoFromUser;
178
178
  });
179
- // deviceInfo['deviceInfoFromUser'] = this.deviceInfoFromUser;
180
- deviceInfo['microphoneFromAPI'] = this.microphoneFromAPI;
181
- deviceInfo['microphoneDeviceId'] = this.microphoneDeviceId;
182
- deviceInfo['screenWidth'] = window.screen.width;
183
- deviceInfo['screenHeight'] = window.screen.height;
184
- console.log('deviceInfo Inside getDeviceInfo: ', deviceInfo);
185
- this.conn.send({
186
- name: 'deviceInfo',
187
- payload: deviceInfo,
188
- });
189
- return deviceInfo;
190
179
  } catch (error) {
191
180
  console.error('Error fetching or executing script:', error.message);
192
- return null;
193
181
  }
182
+ // deviceInfo['deviceInfoFromUser'] = this.deviceInfoFromUser;
183
+ deviceInfo['microphoneFromAPI'] = this.microphoneFromAPI;
184
+ deviceInfo['microphoneDeviceId'] = this.microphoneDeviceId;
185
+ deviceInfo['screenWidth'] = window.screen.width;
186
+ deviceInfo['screenHeight'] = window.screen.height;
187
+ console.log('deviceInfo Inside getDeviceInfo: ', deviceInfo);
188
+ this.conn.send({
189
+ name: 'deviceInfo',
190
+ payload: deviceInfo,
191
+ });
192
+ return deviceInfo;
194
193
  };
195
194
 
196
195
  applyHQTrackConstraints = async stream => {
@@ -323,10 +322,13 @@ class Listener extends AudioPeer {
323
322
  .then(settings => {
324
323
  console.log(settings);
325
324
  this.sendSamplingRate(settings.sampleRate);
326
- let sampleSize = settings.sampleSize;
325
+ //let sampleSize = settings.sampleSize;
326
+ let sampleSize = this.calibrateSoundSamplingDesiredBits;
327
+ /*
327
328
  if (!sampleSize) {
328
329
  sampleSize = this.calibrateSoundSamplingDesiredBits;
329
330
  }
331
+ */
330
332
  this.sendSampleSize(sampleSize);
331
333
  this.sendFlags({
332
334
  autoGainControl: settings.autoGainControl,
@@ -6,6 +6,7 @@ import {
6
6
  MissingSpeakerIdError,
7
7
  CalibrationTimedOutError,
8
8
  } from './peerErrors';
9
+ import Peer from 'peerjs';
9
10
 
10
11
  //import {phrases} from '../../dist/example/i18n';
11
12
 
@@ -43,7 +44,7 @@ class Speaker extends AudioPeer {
43
44
  this.isLoudspeakerCalibration = params?.isLoudspeakerCalibration ?? false;
44
45
  this.deviceId = params?.micrpohoneIdFromWebAudioApi ?? '';
45
46
  this.buttonsContainer = params?.buttonsContainer ?? document.createElement('div');
46
- this.phrases = params?. phrases ?? {};
47
+ this.phrases = params?.phrases ?? {};
47
48
 
48
49
  /* Set up callbacks that handle any events related to our peer object. */
49
50
  }
@@ -210,7 +211,7 @@ class Speaker extends AudioPeer {
210
211
  params.language,
211
212
  params.loudspeakerModelName,
212
213
  params.phrases,
213
- params.soundSubtitleId,
214
+ params.soundSubtitleId
214
215
  );
215
216
  speaker.#removeUIElems();
216
217
  resolve(speaker.result);
@@ -288,7 +289,7 @@ class Speaker extends AudioPeer {
288
289
  hz: this.calibrateSoundHz,
289
290
  bits: this.calibrateSoundSamplingDesiredBits,
290
291
  lang: this.language,
291
- deviceId: this.deviceId
292
+ deviceId: this.deviceId,
292
293
  };
293
294
  const queryString = this.queryStringFromObject(queryStringParameters);
294
295
  this.uri = this.siteUrl + queryString;
@@ -720,7 +721,7 @@ class Speaker extends AudioPeer {
720
721
  params.language,
721
722
  params.loudspeakerModelName,
722
723
  params.phrases,
723
- params.soundSubtitleId,
724
+ params.soundSubtitleId
724
725
  );
725
726
  this.#removeUIElems();
726
727
  resolve(result);