@stormstreaming/stormstreamer 1.0.4 → 1.0.6

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Change Log
2
2
 
3
+ ## 1.0.6
4
+
5
+ Fixed intervals not being properly cleaned up when player instance is removed,
6
+
7
+ ## 1.0.5
8
+
9
+ Bugfix for destroying Network Controller,
10
+
3
11
  ## 1.0.4
4
12
 
5
13
  Bugfix for initialize() & start() methods race condition,
package/dist/amd/index.js CHANGED
@@ -4,8 +4,8 @@
4
4
  * contact@stormstreaming.com
5
5
  * https://stormstreaming.com
6
6
  *
7
- * Version: 1.0.4
8
- * Version: 2/19/2026, 11:12:13 AM
7
+ * Version: 1.0.6
8
+ * Version: 2/22/2026, 12:57:01 PM
9
9
  *
10
10
  * LEGAL NOTICE:
11
11
  * This software is subject to the terms and conditions defined in
@@ -4009,6 +4009,7 @@
4009
4009
  this.socket.onerror = null;
4010
4010
  this.socket.close();
4011
4011
  }
4012
+ clearTimeout(this._connectionTimeout);
4012
4013
  }
4013
4014
  /**
4014
4015
  * Destroys connection
@@ -4016,6 +4017,10 @@
4016
4017
  * @protected
4017
4018
  */
4018
4019
  destroy() {
4020
+ if (this._connectionTimeout != null) {
4021
+ clearTimeout(this._connectionTimeout);
4022
+ this._connectionTimeout = null;
4023
+ }
4019
4024
  if (this.socket !== undefined && this.socket !== null) {
4020
4025
  this.socket.onopen = null;
4021
4026
  this.socket.onmessage = null;
@@ -4597,10 +4602,10 @@
4597
4602
  if (this._publishState == exports.PublishState.CONNECTED && update.publishState == exports.PublishState.PUBLISHED) this.setPublishState(exports.PublishState.PUBLISHED);
4598
4603
  };
4599
4604
  this.onDescriptionSuccess = description => {
4600
- var _a, _b;
4605
+ var _a, _b, _c;
4601
4606
  if (this._isDestroyed) return;
4602
4607
  const streamInfo = {
4603
- applicationName: (_b = (_a = this._main.getNetworkController()) === null || _a === void 0 ? void 0 : _a.getConnection().getCurrentServer()) === null || _b === void 0 ? void 0 : _b.getApplication(),
4608
+ applicationName: (_c = (_b = (_a = this._main.getNetworkController()) === null || _a === void 0 ? void 0 : _a.getConnection()) === null || _b === void 0 ? void 0 : _b.getCurrentServer()) === null || _c === void 0 ? void 0 : _c.getApplication(),
4604
4609
  streamName: this._fullStreamName,
4605
4610
  sessionId: "[empty]"
4606
4611
  };
@@ -6138,6 +6143,8 @@
6138
6143
  */
6139
6144
  constructor(main, networkController) {
6140
6145
  super();
6146
+ // WowzaConnection
6147
+ this._isDestroyed = false;
6141
6148
  this._logger = main.getLogger();
6142
6149
  this._main = main;
6143
6150
  this._networkController = networkController;
@@ -6249,9 +6256,7 @@
6249
6256
  initiateReconnect() {
6250
6257
  const shouldReconnect = this._main.getConfigManager().getSettingsData().getIfRestartOnError();
6251
6258
  const reconnectTime = this._main.getConfigManager().getSettingsData().getReconnectTime();
6252
- if (this._disconnectedByUser) {
6253
- return;
6254
- }
6259
+ if (this._isDestroyed || this._disconnectedByUser) return;
6255
6260
  if (shouldReconnect) {
6256
6261
  if (this._reconnectTimer != null) clearTimeout(this._reconnectTimer);
6257
6262
  this._reconnectTimer = setTimeout(() => {
@@ -6307,6 +6312,7 @@
6307
6312
  * Destroys object and clean-ups everything that is needed
6308
6313
  */
6309
6314
  destroy() {
6315
+ this._isDestroyed = true;
6310
6316
  super.destroy();
6311
6317
  if (this._reconnectTimer != null) clearTimeout(this._reconnectTimer);
6312
6318
  }
@@ -6324,6 +6330,11 @@
6324
6330
  * @param main reference to the main class
6325
6331
  */
6326
6332
  constructor(main) {
6333
+ /**
6334
+ * Object containing WebSocket Connection (only one is needed)
6335
+ * @private
6336
+ */
6337
+ this._connection = null;
6327
6338
  /**
6328
6339
  * Current streamKey
6329
6340
  * @private
@@ -6334,6 +6345,7 @@
6334
6345
  * @private
6335
6346
  */
6336
6347
  this._lastState = "";
6348
+ this._isDestroyed = false;
6337
6349
  //------------------------------------------------------------------------//
6338
6350
  // CONNECTION-RELATED METHODS
6339
6351
  //------------------------------------------------------------------------//
@@ -6356,6 +6368,7 @@
6356
6368
  // MAIN METHODS
6357
6369
  //------------------------------------------------------------------------//
6358
6370
  initialize() {
6371
+ if (this._isDestroyed) return;
6359
6372
  if (this._connection != null) {
6360
6373
  if (this._connection.getConnectionState() == ConnectionState.CONNECTING || this._connection.getConnectionState() == ConnectionState.CONNECTED) {
6361
6374
  this._logger.info(this, "Connection is alive, not doing anything!");
@@ -6369,10 +6382,12 @@
6369
6382
  this._connection = new WowzaConnection(this._main, this);
6370
6383
  }
6371
6384
  stop() {
6372
- this._connection.disconnect(true);
6385
+ var _a;
6386
+ (_a = this._connection) === null || _a === void 0 ? void 0 : _a.disconnect(true);
6373
6387
  this._lastState = "";
6374
6388
  }
6375
6389
  sendMessage(message) {
6390
+ if (this._isDestroyed || !this._connection) return;
6376
6391
  if (this._connection.isConnectionActive()) {
6377
6392
  this._connection.sendData(message);
6378
6393
  }
@@ -6392,6 +6407,16 @@
6392
6407
  getCurrentStreamKey() {
6393
6408
  return this._currentStreamKey;
6394
6409
  }
6410
+ destroy() {
6411
+ this._isDestroyed = true;
6412
+ // Odepnij listenery
6413
+ this._main.removeEventListener("serverConnect", this.onServerConnect);
6414
+ this._main.removeEventListener("serverDisconnect", this.onServerDisconnect);
6415
+ if (this._connection) {
6416
+ this._connection.destroy();
6417
+ this._connection = null;
6418
+ }
6419
+ }
6395
6420
  }
6396
6421
 
6397
6422
  class StatsController {
@@ -6735,8 +6760,8 @@
6735
6760
  constructor(streamConfig, autoInitialize = false) {
6736
6761
  super();
6737
6762
  this.DEV_MODE = true;
6738
- this.STREAMER_VERSION = "1.0.4";
6739
- this.COMPILE_DATE = "2/19/2026, 11:12:11 AM";
6763
+ this.STREAMER_VERSION = "1.0.6";
6764
+ this.COMPILE_DATE = "2/22/2026, 12:56:59 PM";
6740
6765
  this.STREAMER_BRANCH = "Experimental";
6741
6766
  this.STREAMER_PROTOCOL_VERSION = 1;
6742
6767
  this._initialized = false;
@@ -6796,8 +6821,8 @@
6796
6821
  }
6797
6822
  // PLAYBACK / STREAMING
6798
6823
  isConnected() {
6799
- var _a, _b;
6800
- return (_b = (_a = this._networkController) === null || _a === void 0 ? void 0 : _a.getConnection().isConnectionActive()) !== null && _b !== void 0 ? _b : false;
6824
+ var _a, _b, _c;
6825
+ return (_c = (_b = (_a = this._networkController) === null || _a === void 0 ? void 0 : _a.getConnection()) === null || _b === void 0 ? void 0 : _b.isConnectionActive()) !== null && _c !== void 0 ? _c : false;
6801
6826
  }
6802
6827
  mute() {
6803
6828
  var _a;
@@ -7083,7 +7108,7 @@
7083
7108
  * All pending async operations will detect the destroyed state and abort.
7084
7109
  */
7085
7110
  destroy() {
7086
- var _a, _b, _c, _d, _e, _f, _g;
7111
+ var _a, _b, _c, _d, _e, _f;
7087
7112
  // Prevent double destroy
7088
7113
  if (this._isDestroyed) {
7089
7114
  (_a = this._logger) === null || _a === void 0 ? void 0 : _a.warning(this, "🔴 [DESTROY] Already destroyed, skipping");
@@ -7101,23 +7126,20 @@
7101
7126
  // Stop all graphs
7102
7127
  this.stopAllGraphs();
7103
7128
  this._graphs = [];
7104
- // Destroy network controller
7105
7129
  if (this._networkController) {
7106
7130
  (_c = this._logger) === null || _c === void 0 ? void 0 : _c.info(this, "🔴 [DESTROY] Destroying NetworkController...");
7107
- try {
7108
- (_d = this._networkController.getConnection()) === null || _d === void 0 ? void 0 : _d.destroy();
7109
- } catch (e) {/* ignore */}
7131
+ this._networkController.destroy();
7110
7132
  this._networkController = null;
7111
7133
  }
7112
7134
  // Destroy streamer controller (this is also sync now)
7113
7135
  if (this._streamerController) {
7114
- (_e = this._logger) === null || _e === void 0 ? void 0 : _e.info(this, "🔴 [DESTROY] Destroying StreamerController...");
7136
+ (_d = this._logger) === null || _d === void 0 ? void 0 : _d.info(this, "🔴 [DESTROY] Destroying StreamerController...");
7115
7137
  this._streamerController.destroy();
7116
7138
  this._streamerController = null;
7117
7139
  }
7118
7140
  // Destroy stage controller
7119
7141
  if (this._stageController) {
7120
- (_f = this._logger) === null || _f === void 0 ? void 0 : _f.info(this, "🔴 [DESTROY] Destroying StageController...");
7142
+ (_e = this._logger) === null || _e === void 0 ? void 0 : _e.info(this, "🔴 [DESTROY] Destroying StageController...");
7121
7143
  try {
7122
7144
  this._stageController.destroy();
7123
7145
  } catch (e) {/* ignore */}
@@ -7128,7 +7150,7 @@
7128
7150
  this._statsController = null;
7129
7151
  // Remove all event listeners
7130
7152
  this.removeAllEventListeners();
7131
- (_g = this._logger) === null || _g === void 0 ? void 0 : _g.success(this, "🔴 [DESTROY] Streamer instance destroyed successfully (sync)");
7153
+ (_f = this._logger) === null || _f === void 0 ? void 0 : _f.success(this, "🔴 [DESTROY] Streamer instance destroyed successfully (sync)");
7132
7154
  }
7133
7155
  }
7134
7156
  StormStreamer.NEXT_STREAMER_ID = 0;