@reactoo/watchtogether-sdk-js 2.6.20 → 2.6.21
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
|
@@ -384,11 +384,22 @@ let roomSession = function ({roomId, pinHash, role}, room, wt) {
|
|
|
384
384
|
},
|
|
385
385
|
|
|
386
386
|
__sendMuteStatus: function () {
|
|
387
|
-
for(const val
|
|
387
|
+
for(const val of room.isMuted) {
|
|
388
388
|
this.sendSystemMessage('remote_muted', {...val});
|
|
389
389
|
}
|
|
390
390
|
},
|
|
391
391
|
|
|
392
|
+
__test: function (value) {
|
|
393
|
+
return room.sendMessage(room.handleId, {
|
|
394
|
+
body: {
|
|
395
|
+
request: "data",
|
|
396
|
+
room: room.roomId,
|
|
397
|
+
timestamp: new Date().getTime(),
|
|
398
|
+
text: JSON.stringify(value),
|
|
399
|
+
}
|
|
400
|
+
});
|
|
401
|
+
},
|
|
402
|
+
|
|
392
403
|
$on: (key, callback, that) => {
|
|
393
404
|
emitter.on(key, callback, that || this);
|
|
394
405
|
room.on(key, callback, that || this);
|
package/src/modules/wt-room.js
CHANGED
|
@@ -2272,6 +2272,43 @@ class RoomSession {
|
|
|
2272
2272
|
jsep
|
|
2273
2273
|
});
|
|
2274
2274
|
})
|
|
2275
|
+
.then((r) => {
|
|
2276
|
+
if (this._isDataChannelOpen === true) {
|
|
2277
|
+
return Promise.resolve(r)
|
|
2278
|
+
} else {
|
|
2279
|
+
return new Promise((resolve, reject) => {
|
|
2280
|
+
|
|
2281
|
+
let dataChannelTimeoutId = null;
|
|
2282
|
+
|
|
2283
|
+
let _resolve = (val) => {
|
|
2284
|
+
if (val) {
|
|
2285
|
+
clearTimeout(dataChannelTimeoutId);
|
|
2286
|
+
this._abortController.signal.removeEventListener('abort', _rejectAbort);
|
|
2287
|
+
this.off('dataChannel', _resolve, this);
|
|
2288
|
+
resolve(this);
|
|
2289
|
+
}
|
|
2290
|
+
};
|
|
2291
|
+
|
|
2292
|
+
let _rejectTimeout = () => {
|
|
2293
|
+
this.off('dataChannel', _resolve, this);
|
|
2294
|
+
this._abortController.signal.removeEventListener('abort', _rejectAbort);
|
|
2295
|
+
reject({type: 'error', id: 27, message: 'Data channel did not open', data: null});
|
|
2296
|
+
}
|
|
2297
|
+
|
|
2298
|
+
let _rejectAbort = () => {
|
|
2299
|
+
this._abortController.signal.removeEventListener('abort', _rejectAbort);
|
|
2300
|
+
clearTimeout(dataChannelTimeoutId);
|
|
2301
|
+
this.off('dataChannel', _resolve, this);
|
|
2302
|
+
reject({type: 'warning', id: 17, message: 'Connection cancelled'})
|
|
2303
|
+
}
|
|
2304
|
+
|
|
2305
|
+
dataChannelTimeoutId = setTimeout(_rejectTimeout, 5000);
|
|
2306
|
+
this._abortController.signal.addEventListener('abort', _rejectAbort);
|
|
2307
|
+
|
|
2308
|
+
this.on('dataChannel', _resolve, this);
|
|
2309
|
+
});
|
|
2310
|
+
}
|
|
2311
|
+
})
|
|
2275
2312
|
.then(() => emitEvents())
|
|
2276
2313
|
.catch(e => {
|
|
2277
2314
|
this.emit('publishing', false);
|