speaker-calibration 2.2.168 → 2.2.170
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 +1525 -1569
- package/dist/main.js +3 -3
- package/package.json +1 -1
- package/src/peer-connection/speaker.js +34 -6
- 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,24 @@ 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.style = `
|
|
225
|
+
word-break: break-all; /* Break long words or URLs */
|
|
226
|
+
overflow-wrap: break-word; /* Ensure long URLs or text break properly */
|
|
227
|
+
`;
|
|
228
|
+
explanation.innerHTML = phrases.RC_skipQR_ExplanationWithoutPreferNot[this.language]
|
|
229
|
+
.replace("xxx", `<b>${this.uri}</b>`)
|
|
230
|
+
.replace("XXX", `<b>${this.uri}</b>`);
|
|
231
|
+
|
|
218
232
|
const qrImage = new Image(400, 400);
|
|
219
233
|
qrImage.setAttribute('id', 'compatibilityCheckQRImage');
|
|
220
234
|
qrImage.style.zIndex = Infinity;
|
|
@@ -224,7 +238,21 @@ class Speaker extends AudioPeer {
|
|
|
224
238
|
qrImage.src = qrCanvas.toDataURL();
|
|
225
239
|
qrImage.style.maxHeight = '150px';
|
|
226
240
|
qrImage.style.maxWidth = '150px';
|
|
227
|
-
|
|
241
|
+
|
|
242
|
+
this.qrImage = qrImage;
|
|
243
|
+
|
|
244
|
+
const container = document.createElement("div");
|
|
245
|
+
container.style.display = "flex";
|
|
246
|
+
container.style.justifyContent = "space-between";
|
|
247
|
+
container.style.alignItems = "center";
|
|
248
|
+
container.id = "skipQRContainer";
|
|
249
|
+
container.appendChild(qrImage);
|
|
250
|
+
container.appendChild(explanation);
|
|
251
|
+
const qrContainer = document.createElement("div");
|
|
252
|
+
qrContainer.appendChild(container);
|
|
253
|
+
qrContainer.appendChild(this.buttonsContainer);
|
|
254
|
+
|
|
255
|
+
document.getElementById(this.targetElement).appendChild(qrContainer);
|
|
228
256
|
} else {
|
|
229
257
|
// show the link to the user
|
|
230
258
|
// If specified HTML Id is available, show QR code there
|
|
@@ -242,7 +270,7 @@ class Speaker extends AudioPeer {
|
|
|
242
270
|
proceedButton.innerHTML = 'Proceed';
|
|
243
271
|
proceedButton.onclick = () => {
|
|
244
272
|
// open the link in a new tab
|
|
245
|
-
window.open(uri, '_blank');
|
|
273
|
+
window.open(this.uri, '_blank');
|
|
246
274
|
// remove the button
|
|
247
275
|
document.getElementById('calibrationProceedButton').remove();
|
|
248
276
|
};
|
|
@@ -250,7 +278,7 @@ class Speaker extends AudioPeer {
|
|
|
250
278
|
}
|
|
251
279
|
}
|
|
252
280
|
// or just print it to console
|
|
253
|
-
console.log('TEST: Peer reachable at: ', uri);
|
|
281
|
+
console.log('TEST: Peer reachable at: ', this.uri);
|
|
254
282
|
};
|
|
255
283
|
|
|
256
284
|
#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();
|