@reactoo/watchtogether-sdk-js 2.7.92-beta.0 → 2.7.92-beta.1
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.
|
@@ -9874,6 +9874,7 @@ class RoomSession {
|
|
|
9874
9874
|
this.isConnecting = false;
|
|
9875
9875
|
this.isDisconnecting = false;
|
|
9876
9876
|
this.isConnected = false;
|
|
9877
|
+
this.isPossibleToPublish = false; // we added this because joined event happened after we fired publish, im' not sure what relies on current event based isConnected flag so i've added a new one
|
|
9877
9878
|
this.isPublished = false;
|
|
9878
9879
|
this.isStreaming = false;
|
|
9879
9880
|
this.isMuted = [];
|
|
@@ -10121,7 +10122,6 @@ class RoomSession {
|
|
|
10121
10122
|
if (json['janus'] === 'error') {
|
|
10122
10123
|
var _json$error;
|
|
10123
10124
|
if ((json === null || json === void 0 ? void 0 : (_json$error = json.error) === null || _json$error === void 0 ? void 0 : _json$error.code) == 403) {
|
|
10124
|
-
console.log(1);
|
|
10125
10125
|
this.disconnect(true);
|
|
10126
10126
|
}
|
|
10127
10127
|
reject({
|
|
@@ -10204,7 +10204,6 @@ class RoomSession {
|
|
|
10204
10204
|
this._retries++;
|
|
10205
10205
|
if (this._retries > this._maxRetries) {
|
|
10206
10206
|
if (this.sessiontype === 'reactooroom') {
|
|
10207
|
-
console.log(2);
|
|
10208
10207
|
this.disconnect(true);
|
|
10209
10208
|
} else if (this.sessiontype === 'streaming') {
|
|
10210
10209
|
this.stopStream();
|
|
@@ -10233,7 +10232,6 @@ class RoomSession {
|
|
|
10233
10232
|
}, 3000 * this._retries);
|
|
10234
10233
|
} else {
|
|
10235
10234
|
if (this.sessiontype === 'reactooroom') {
|
|
10236
|
-
console.log(3);
|
|
10237
10235
|
this.disconnect(true);
|
|
10238
10236
|
} else if (this.sessiontype === 'streaming') {
|
|
10239
10237
|
this.stopStream();
|
|
@@ -10366,6 +10364,7 @@ class RoomSession {
|
|
|
10366
10364
|
this.id = msg["id"];
|
|
10367
10365
|
this.privateId = msg["private_id"];
|
|
10368
10366
|
this.isConnected = true;
|
|
10367
|
+
this.isPossibleToPublish = true;
|
|
10369
10368
|
this._log('We have successfully joined Room');
|
|
10370
10369
|
this.emit('joined', true, this.constructId);
|
|
10371
10370
|
this.emit('addLocalParticipant', {
|
|
@@ -10501,7 +10500,6 @@ class RoomSession {
|
|
|
10501
10500
|
this._removeParticipant(this.handleId);
|
|
10502
10501
|
if (msg['reason'] === 'kicked') {
|
|
10503
10502
|
this.emit('kicked');
|
|
10504
|
-
console.log(4);
|
|
10505
10503
|
this.disconnect().catch(() => {});
|
|
10506
10504
|
}
|
|
10507
10505
|
} else if (leaving) {
|
|
@@ -10977,6 +10975,7 @@ class RoomSession {
|
|
|
10977
10975
|
}
|
|
10978
10976
|
}, dontWait).finally(() => {
|
|
10979
10977
|
this.isConnected = false;
|
|
10978
|
+
this.isPossibleToPublish = false;
|
|
10980
10979
|
this.emit('joined', false);
|
|
10981
10980
|
}) : Promise.resolve();
|
|
10982
10981
|
}
|
|
@@ -10989,6 +10988,7 @@ class RoomSession {
|
|
|
10989
10988
|
message: 'connection establishment already in progress'
|
|
10990
10989
|
});
|
|
10991
10990
|
}
|
|
10991
|
+
this.isPossibleToPublish = false;
|
|
10992
10992
|
this.isConnecting = true;
|
|
10993
10993
|
this.emit('joining', true);
|
|
10994
10994
|
if (this.ws) {
|
|
@@ -11035,6 +11035,7 @@ class RoomSession {
|
|
|
11035
11035
|
this._enableStatsWatch();
|
|
11036
11036
|
this._enableSubstreamAutoSelect();
|
|
11037
11037
|
this.isConnecting = false;
|
|
11038
|
+
this.isPossibleToPublish = true;
|
|
11038
11039
|
this.emit('joining', false);
|
|
11039
11040
|
resolve(this);
|
|
11040
11041
|
}).catch(error => {
|
|
@@ -11085,6 +11086,23 @@ class RoomSession {
|
|
|
11085
11086
|
}
|
|
11086
11087
|
_httpConnection() {
|
|
11087
11088
|
let reclaim = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
11089
|
+
if (this.isConnecting) {
|
|
11090
|
+
return Promise.reject({
|
|
11091
|
+
type: 'warning',
|
|
11092
|
+
id: 16,
|
|
11093
|
+
message: 'connection establishment already in progress'
|
|
11094
|
+
});
|
|
11095
|
+
}
|
|
11096
|
+
this.isPossibleToPublish = false;
|
|
11097
|
+
this.isConnecting = true;
|
|
11098
|
+
this.emit('joining', true);
|
|
11099
|
+
if (this.ws) {
|
|
11100
|
+
this._wipeListeners();
|
|
11101
|
+
if (this.ws.readyState === 1) {
|
|
11102
|
+
this.ws.close();
|
|
11103
|
+
}
|
|
11104
|
+
}
|
|
11105
|
+
this._stopKeepAlive();
|
|
11088
11106
|
if (!reclaim) {
|
|
11089
11107
|
return this._send({
|
|
11090
11108
|
"janus": "create"
|
|
@@ -11101,6 +11119,7 @@ class RoomSession {
|
|
|
11101
11119
|
this._enableSubstreamAutoSelect();
|
|
11102
11120
|
this._longPoll();
|
|
11103
11121
|
this.isConnecting = false;
|
|
11122
|
+
this.isPossibleToPublish = true;
|
|
11104
11123
|
this.emit('joining', false);
|
|
11105
11124
|
return Promise.resolve(this);
|
|
11106
11125
|
}).catch(error => {
|
|
@@ -11201,6 +11220,7 @@ class RoomSession {
|
|
|
11201
11220
|
return Promise.resolve();
|
|
11202
11221
|
}
|
|
11203
11222
|
(_this$_abortControlle = this._abortController) === null || _this$_abortControlle === void 0 ? void 0 : (_this$_abortControlle2 = _this$_abortControlle.abort) === null || _this$_abortControlle2 === void 0 ? void 0 : _this$_abortControlle2.call(_this$_abortControlle);
|
|
11223
|
+
this.isPossibleToPublish = false;
|
|
11204
11224
|
this.isDisconnecting = true;
|
|
11205
11225
|
this._stopKeepAlive();
|
|
11206
11226
|
this._disableStatsWatch();
|
|
@@ -11321,6 +11341,7 @@ class RoomSession {
|
|
|
11321
11341
|
(_this$_abortControlle3 = this._abortController) === null || _this$_abortControlle3 === void 0 ? void 0 : (_this$_abortControlle4 = _this$_abortControlle3.abort) === null || _this$_abortControlle4 === void 0 ? void 0 : _this$_abortControlle4.call(_this$_abortControlle3);
|
|
11322
11342
|
this._stopKeepAlive();
|
|
11323
11343
|
let isStreaming = this.isStreaming;
|
|
11344
|
+
this.isPossibleToPublish = false;
|
|
11324
11345
|
this.isDisconnecting = true;
|
|
11325
11346
|
return this._removeParticipant(this.handleId).finally(() => {
|
|
11326
11347
|
this.sendMessage(this.handleId, {
|
|
@@ -11346,7 +11367,6 @@ class RoomSession {
|
|
|
11346
11367
|
}
|
|
11347
11368
|
destroy() {
|
|
11348
11369
|
if (this.sessiontype === 'reactooroom') {
|
|
11349
|
-
console.log(5);
|
|
11350
11370
|
return this.disconnect().then(() => {
|
|
11351
11371
|
this.clear();
|
|
11352
11372
|
return true;
|
|
@@ -12377,8 +12397,7 @@ class RoomSession {
|
|
|
12377
12397
|
var _stream$getVideoTrack, _stream$getAudioTrack, _config$stream4, _config$stream4$getAu, _config$stream5, _config$stream5$getVi, _stream$getAudioTrack2, _stream$getVideoTrack2;
|
|
12378
12398
|
let stream = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
12379
12399
|
let source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'camera0';
|
|
12380
|
-
|
|
12381
|
-
if (this.isDisconnecting || !this.isConnected) {
|
|
12400
|
+
if (!this.isPossibleToPublish) {
|
|
12382
12401
|
return Promise.reject({
|
|
12383
12402
|
type: 'warning',
|
|
12384
12403
|
id: 18,
|