speaker-calibration 2.2.168 → 2.2.169
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 +1528 -1357
- package/dist/main.js +3 -3
- package/package.json +1 -1
- package/src/peer-connection/speaker.js +29 -5
- package/src/tasks/combination/combination.js +1 -1
package/package.json
CHANGED
|
@@ -41,6 +41,7 @@ class Speaker extends AudioPeer {
|
|
|
41
41
|
this.timeToCalibrate = params?.timeToCalibrate ?? 10;
|
|
42
42
|
this.isParticipant = params?.isParticipant ?? false;
|
|
43
43
|
this.isLoudspeakerCalibration = params?.isLoudspeakerCalibration ?? false;
|
|
44
|
+
this.buttonsContainer = params?.buttonsContainer ?? document.createElement('div');
|
|
44
45
|
|
|
45
46
|
/* Set up callbacks that handle any events related to our peer object. */
|
|
46
47
|
this.peer.on('open', this.#onPeerOpen);
|
|
@@ -49,6 +50,9 @@ class Speaker extends AudioPeer {
|
|
|
49
50
|
this.peer.on('disconnected', this.#onPeerDisconnected);
|
|
50
51
|
this.peer.on('error', this.#onPeerError);
|
|
51
52
|
}
|
|
53
|
+
|
|
54
|
+
uri = '';
|
|
55
|
+
qrImage;
|
|
52
56
|
/**
|
|
53
57
|
* Async factory method that creates the Speaker object, and returns a promise that resolves to the result of the calibration.
|
|
54
58
|
*
|
|
@@ -196,6 +200,7 @@ class Speaker extends AudioPeer {
|
|
|
196
200
|
* @private
|
|
197
201
|
* @example
|
|
198
202
|
*/
|
|
203
|
+
|
|
199
204
|
#showQRCode = () => {
|
|
200
205
|
// Get query string, the URL parameters to specify a Listener
|
|
201
206
|
const queryStringParameters = {
|
|
@@ -206,15 +211,20 @@ class Speaker extends AudioPeer {
|
|
|
206
211
|
lang: this.language,
|
|
207
212
|
};
|
|
208
213
|
const queryString = this.queryStringFromObject(queryStringParameters);
|
|
209
|
-
|
|
214
|
+
this.uri = this.siteUrl + queryString;
|
|
210
215
|
if (this.isSmartPhone) {
|
|
211
216
|
// Display QR code for the participant to scan
|
|
212
217
|
const qrCanvas = document.createElement('canvas');
|
|
213
218
|
qrCanvas.setAttribute('id', 'qrCanvas');
|
|
214
|
-
|
|
215
|
-
QRCode.toCanvas(qrCanvas, uri, error => {
|
|
219
|
+
QRCode.toCanvas(qrCanvas, this.uri, error => {
|
|
216
220
|
if (error) console.error(error);
|
|
217
221
|
});
|
|
222
|
+
const explanation = document.createElement("p");
|
|
223
|
+
explanation.id = "skipQRExplanation";
|
|
224
|
+
explanation.innerHTML = phrases.RC_skipQR_ExplanationWithoutPreferNot[this.language]
|
|
225
|
+
.replace("xxx", `<b>${this.uri}</b>`)
|
|
226
|
+
.replace("XXX", `<b>${this.uri}</b>`);
|
|
227
|
+
|
|
218
228
|
const qrImage = new Image(400, 400);
|
|
219
229
|
qrImage.setAttribute('id', 'compatibilityCheckQRImage');
|
|
220
230
|
qrImage.style.zIndex = Infinity;
|
|
@@ -224,7 +234,21 @@ class Speaker extends AudioPeer {
|
|
|
224
234
|
qrImage.src = qrCanvas.toDataURL();
|
|
225
235
|
qrImage.style.maxHeight = '150px';
|
|
226
236
|
qrImage.style.maxWidth = '150px';
|
|
227
|
-
|
|
237
|
+
|
|
238
|
+
this.qrImage = qrImage;
|
|
239
|
+
|
|
240
|
+
const container = document.createElement("div");
|
|
241
|
+
container.style.display = "flex";
|
|
242
|
+
container.style.justifyContent = "space-between";
|
|
243
|
+
container.style.alignItems = "center";
|
|
244
|
+
container.id = "skipQRContainer";
|
|
245
|
+
container.appendChild(qrImage);
|
|
246
|
+
container.appendChild(explanation);
|
|
247
|
+
const qrContainer = document.createElement("div");
|
|
248
|
+
qrContainer.appendChild(container);
|
|
249
|
+
qrContainer.appendChild(this.buttonsContainer);
|
|
250
|
+
|
|
251
|
+
document.getElementById(this.targetElement).appendChild(qrContainer);
|
|
228
252
|
} else {
|
|
229
253
|
// show the link to the user
|
|
230
254
|
// If specified HTML Id is available, show QR code there
|
|
@@ -250,7 +274,7 @@ class Speaker extends AudioPeer {
|
|
|
250
274
|
}
|
|
251
275
|
}
|
|
252
276
|
// or just print it to console
|
|
253
|
-
console.log('TEST: Peer reachable at: ', uri);
|
|
277
|
+
console.log('TEST: Peer reachable at: ', this.uri);
|
|
254
278
|
};
|
|
255
279
|
|
|
256
280
|
#showSpinner = () => {
|
|
@@ -859,7 +859,7 @@ class Combination extends AudioCalibrator {
|
|
|
859
859
|
this.status = ``;
|
|
860
860
|
if (this.mode === 'unfiltered') {
|
|
861
861
|
console.log('play calibration audio ' + this.stepNum);
|
|
862
|
-
this.addTimeStamp(`
|
|
862
|
+
this.addTimeStamp(`Play MLS version ${this.icapture}`);
|
|
863
863
|
this.status =
|
|
864
864
|
`All Hz Calibration: playing the calibration tone...`.toString() +
|
|
865
865
|
this.generateTemplate().toString();
|