speaker-calibration 2.2.175 → 2.2.176
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 +1054 -1054
- package/dist/main.js +3 -3
- package/package.json +1 -1
- package/src/peer-connection/speaker.js +14 -33
- package/src/server/PythonServerAPI.js +30 -0
package/package.json
CHANGED
|
@@ -270,7 +270,7 @@ class Speaker extends AudioPeer {
|
|
|
270
270
|
* @example
|
|
271
271
|
*/
|
|
272
272
|
|
|
273
|
-
#showQRCode = () => {
|
|
273
|
+
#showQRCode = async () => {
|
|
274
274
|
// Get query string, the URL parameters to specify a Listener
|
|
275
275
|
const queryStringParameters = {
|
|
276
276
|
speakerPeerId: this.peer.id,
|
|
@@ -282,6 +282,7 @@ class Speaker extends AudioPeer {
|
|
|
282
282
|
const queryString = this.queryStringFromObject(queryStringParameters);
|
|
283
283
|
this.uri = this.siteUrl + queryString;
|
|
284
284
|
if (this.isSmartPhone) {
|
|
285
|
+
// if (true) { // test smartphone QR
|
|
285
286
|
// Display QR code for the participant to scan
|
|
286
287
|
const qrCanvas = document.createElement('canvas');
|
|
287
288
|
qrCanvas.setAttribute('id', 'qrCanvas');
|
|
@@ -293,38 +294,18 @@ class Speaker extends AudioPeer {
|
|
|
293
294
|
explanation.style = `
|
|
294
295
|
user-select: text;
|
|
295
296
|
`;
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
originalURL: this.uri
|
|
309
|
-
})
|
|
310
|
-
};
|
|
311
|
-
|
|
312
|
-
// Make the request using fetch
|
|
313
|
-
fetch(url, options)
|
|
314
|
-
.then(response => {
|
|
315
|
-
if (!response.ok) {
|
|
316
|
-
throw new Error(`HTTP error! Status: ${response.status}`);
|
|
317
|
-
}
|
|
318
|
-
return response.json(); // Parse the JSON response
|
|
319
|
-
})
|
|
320
|
-
.then(data => {
|
|
321
|
-
explanation.innerHTML = phrases.RC_skipQR_ExplanationWithoutPreferNot[this.language]
|
|
322
|
-
.replace("xxx", `<b style="user-select: text">${data.shortURL}</b>`)
|
|
323
|
-
.replace("XXX", `<b style="user-select: text">${data.shortURL}</b>`);
|
|
324
|
-
})
|
|
325
|
-
.catch(error => {
|
|
326
|
-
console.error('Error:', error.message); // Handle errors
|
|
327
|
-
});
|
|
297
|
+
await this.ac.pyServerAPI.getShortURL(this.uri)
|
|
298
|
+
.then(response =>{
|
|
299
|
+
return response.shortURL;
|
|
300
|
+
})
|
|
301
|
+
.then(shortURL => {
|
|
302
|
+
explanation.innerHTML = phrases.RC_skipQR_ExplanationWithoutPreferNot[this.language]
|
|
303
|
+
.replace("xxx", `<b style="user-select: text">${shortURL}</b>`)
|
|
304
|
+
.replace("XXX", `<b style="user-select: text">${shortURL}</b>`);
|
|
305
|
+
})
|
|
306
|
+
.catch(error => {
|
|
307
|
+
console.error('Error:', error.message); // Handle errors
|
|
308
|
+
});
|
|
328
309
|
|
|
329
310
|
|
|
330
311
|
|
|
@@ -171,6 +171,36 @@ class PythonServerAPI {
|
|
|
171
171
|
return res.data[task];
|
|
172
172
|
};
|
|
173
173
|
|
|
174
|
+
getShortURL = async (originalURL) => {
|
|
175
|
+
const task = 'url';
|
|
176
|
+
let res = null;
|
|
177
|
+
console.log(originalURL);
|
|
178
|
+
const data = JSON.stringify({
|
|
179
|
+
'URL': originalURL
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
console.log(data);
|
|
183
|
+
|
|
184
|
+
await axios({
|
|
185
|
+
method: 'post',
|
|
186
|
+
baseURL: PythonServerAPI.PYTHON_SERVER_URL,
|
|
187
|
+
url: `/task/${task}`,
|
|
188
|
+
headers: {
|
|
189
|
+
'Content-Type': 'application/json',
|
|
190
|
+
},
|
|
191
|
+
data,
|
|
192
|
+
})
|
|
193
|
+
.then(response => {
|
|
194
|
+
res = response;
|
|
195
|
+
console.log(res.data[task]);
|
|
196
|
+
})
|
|
197
|
+
.catch(error => {
|
|
198
|
+
throw error;
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
return res.data[task];
|
|
202
|
+
};
|
|
203
|
+
|
|
174
204
|
getMemory = async () => {
|
|
175
205
|
let res;
|
|
176
206
|
await axios({
|