speaker-calibration 2.2.174 → 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 +1355 -1367
- package/dist/main.js +3 -3
- package/package.json +1 -1
- package/src/peer-connection/speaker.js +16 -5
- package/src/server/PythonServerAPI.js +30 -0
package/package.json
CHANGED
|
@@ -48,6 +48,7 @@ class Speaker extends AudioPeer {
|
|
|
48
48
|
|
|
49
49
|
uri = '';
|
|
50
50
|
qrImage;
|
|
51
|
+
shortURL;
|
|
51
52
|
|
|
52
53
|
|
|
53
54
|
initPeer = async () => {
|
|
@@ -269,7 +270,7 @@ class Speaker extends AudioPeer {
|
|
|
269
270
|
* @example
|
|
270
271
|
*/
|
|
271
272
|
|
|
272
|
-
#showQRCode = () => {
|
|
273
|
+
#showQRCode = async () => {
|
|
273
274
|
// Get query string, the URL parameters to specify a Listener
|
|
274
275
|
const queryStringParameters = {
|
|
275
276
|
speakerPeerId: this.peer.id,
|
|
@@ -281,6 +282,7 @@ class Speaker extends AudioPeer {
|
|
|
281
282
|
const queryString = this.queryStringFromObject(queryStringParameters);
|
|
282
283
|
this.uri = this.siteUrl + queryString;
|
|
283
284
|
if (this.isSmartPhone) {
|
|
285
|
+
// if (true) { // test smartphone QR
|
|
284
286
|
// Display QR code for the participant to scan
|
|
285
287
|
const qrCanvas = document.createElement('canvas');
|
|
286
288
|
qrCanvas.setAttribute('id', 'qrCanvas');
|
|
@@ -290,13 +292,22 @@ class Speaker extends AudioPeer {
|
|
|
290
292
|
const explanation = document.createElement("p");
|
|
291
293
|
explanation.id = "skipQRExplanation";
|
|
292
294
|
explanation.style = `
|
|
293
|
-
overflow-wrap: break-word; /* Ensure long URLs or text break properly */
|
|
294
295
|
user-select: text;
|
|
295
296
|
`;
|
|
296
|
-
|
|
297
|
+
await this.ac.pyServerAPI.getShortURL(this.uri)
|
|
298
|
+
.then(response =>{
|
|
299
|
+
return response.shortURL;
|
|
300
|
+
})
|
|
301
|
+
.then(shortURL => {
|
|
297
302
|
explanation.innerHTML = phrases.RC_skipQR_ExplanationWithoutPreferNot[this.language]
|
|
298
|
-
.replace("xxx", `<b style="user-select: text">${
|
|
299
|
-
.replace("XXX", `<b style="user-select: text">${
|
|
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
|
+
});
|
|
309
|
+
|
|
310
|
+
|
|
300
311
|
|
|
301
312
|
const qrImage = new Image(400, 400);
|
|
302
313
|
qrImage.setAttribute('id', 'compatibilityCheckQRImage');
|
|
@@ -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({
|