@reactoo/watchtogether-sdk-js 2.7.90 → 2.7.92-beta.0

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.
@@ -9869,12 +9869,12 @@ class RoomSession {
9869
9869
  this.apisecret = null;
9870
9870
  this.handleId = null;
9871
9871
  this.ws = null;
9872
+ this.isSupposeToBeConnected = false;
9872
9873
  this.isRestarting = false;
9873
9874
  this.isConnecting = false;
9874
9875
  this.isDisconnecting = false;
9875
9876
  this.isConnected = false;
9876
9877
  this.isPublished = false;
9877
- this.isReclaiming = false;
9878
9878
  this.isStreaming = false;
9879
9879
  this.isMuted = [];
9880
9880
  this.isVideoEnabled = false;
@@ -10121,6 +10121,7 @@ class RoomSession {
10121
10121
  if (json['janus'] === 'error') {
10122
10122
  var _json$error;
10123
10123
  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);
10124
10125
  this.disconnect(true);
10125
10126
  }
10126
10127
  reject({
@@ -10189,6 +10190,9 @@ class RoomSession {
10189
10190
  }
10190
10191
  }
10191
10192
  _longPoll() {
10193
+ if (!this.isSupposeToBeConnected) {
10194
+ return;
10195
+ }
10192
10196
  let longpoll = this.server + "/" + this.sessionId + "?rid=" + new Date().getTime();
10193
10197
  if (this._maxev) longpoll = longpoll + "&maxev=" + this._maxev;
10194
10198
  if (this.token) longpoll = longpoll + "&token=" + encodeURIComponent(this.token);
@@ -10200,6 +10204,7 @@ class RoomSession {
10200
10204
  this._retries++;
10201
10205
  if (this._retries > this._maxRetries) {
10202
10206
  if (this.sessiontype === 'reactooroom') {
10207
+ console.log(2);
10203
10208
  this.disconnect(true);
10204
10209
  } else if (this.sessiontype === 'streaming') {
10205
10210
  this.stopStream();
@@ -10228,6 +10233,7 @@ class RoomSession {
10228
10233
  }, 3000 * this._retries);
10229
10234
  } else {
10230
10235
  if (this.sessiontype === 'reactooroom') {
10236
+ console.log(3);
10231
10237
  this.disconnect(true);
10232
10238
  } else if (this.sessiontype === 'streaming') {
10233
10239
  this.stopStream();
@@ -10495,6 +10501,7 @@ class RoomSession {
10495
10501
  this._removeParticipant(this.handleId);
10496
10502
  if (msg['reason'] === 'kicked') {
10497
10503
  this.emit('kicked');
10504
+ console.log(4);
10498
10505
  this.disconnect().catch(() => {});
10499
10506
  }
10500
10507
  } else if (leaving) {
@@ -11144,6 +11151,7 @@ class RoomSession {
11144
11151
  let simulcast = arguments.length > 11 && arguments[11] !== undefined ? arguments[11] : false;
11145
11152
  let simulcastSettings = arguments.length > 12 && arguments[12] !== undefined ? arguments[12] : this.defaultSimulcastSettings;
11146
11153
  let enableDtx = arguments.length > 13 && arguments[13] !== undefined ? arguments[13] : false;
11154
+ this.isSupposeToBeConnected = true;
11147
11155
  if (this.isConnecting) {
11148
11156
  return Promise.reject({
11149
11157
  type: 'warning',
@@ -11188,6 +11196,7 @@ class RoomSession {
11188
11196
  }
11189
11197
  disconnect() {
11190
11198
  var _this$_abortControlle, _this$_abortControlle2;
11199
+ this.isSupposeToBeConnected = false;
11191
11200
  if (this.isDisconnecting) {
11192
11201
  return Promise.resolve();
11193
11202
  }
@@ -11221,6 +11230,7 @@ class RoomSession {
11221
11230
  });
11222
11231
  }
11223
11232
  startStream(streamId, server, iceServers, token, userId) {
11233
+ this.isSupposeToBeConnected = true;
11224
11234
  if (this.isConnecting) {
11225
11235
  return Promise.reject({
11226
11236
  type: 'warning',
@@ -11336,6 +11346,7 @@ class RoomSession {
11336
11346
  }
11337
11347
  destroy() {
11338
11348
  if (this.sessiontype === 'reactooroom') {
11349
+ console.log(5);
11339
11350
  return this.disconnect().then(() => {
11340
11351
  this.clear();
11341
11352
  return true;
@@ -12366,6 +12377,7 @@ class RoomSession {
12366
12377
  var _stream$getVideoTrack, _stream$getAudioTrack, _config$stream4, _config$stream4$getAu, _config$stream5, _config$stream5$getVi, _stream$getAudioTrack2, _stream$getVideoTrack2;
12367
12378
  let stream = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
12368
12379
  let source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'camera0';
12380
+ console.log(this.isDisconnecting, this.isConnected);
12369
12381
  if (this.isDisconnecting || !this.isConnected) {
12370
12382
  return Promise.reject({
12371
12383
  type: 'warning',