@stormstreaming/stormstreamer 0.9.0-beta.7 → 0.9.0-beta.9

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/amd/index.js CHANGED
@@ -4,8 +4,8 @@
4
4
  * contact@stormstreaming.com
5
5
  * https://stormstreaming.com
6
6
  *
7
- * Version: 0.9.0-beta.7
8
- * Version: 1/2/2025, 1:53:46 AM
7
+ * Version: 0.9.0-beta.9
8
+ * Version: 1/7/2025, 3:11:23 PM
9
9
  *
10
10
  * LEGAL NOTICE:
11
11
  * This software is subject to the terms and conditions defined in
@@ -626,7 +626,7 @@
626
626
  return this._debugData;
627
627
  }
628
628
  getIfForceSelection() {
629
- return !this._preselectDevices;
629
+ return this._preselectDevices;
630
630
  }
631
631
  getIfStartOnDOMReadyEnabled() {
632
632
  return this.startOnDOMReady;
@@ -750,14 +750,17 @@
750
750
  }
751
751
  dispatchEvent(eventName, event) {
752
752
  if (this._isRemoved) return;
753
+ let count = 0;
753
754
  if (this._listeners[eventName] != undefined) {
754
755
  if (this._listeners[eventName].length > 0) {
755
756
  for (let i = 0; i < this._listeners[eventName].length; i++) {
757
+ count++;
756
758
  let element = this._listeners[eventName][i];
757
759
  element[1].call(this, event);
758
760
  }
759
761
  }
760
762
  }
763
+ console.log('%c⏵ Event: ' + eventName + ' was dispatched: ' + count + ' times', 'background: yellow; color: black;');
761
764
  }
762
765
  }
763
766
 
@@ -2576,15 +2579,23 @@
2576
2579
  }
2577
2580
  }
2578
2581
 
2579
- exports.DevicesState = void 0;
2580
- (function (DevicesState) {
2581
- DevicesState["NOT_INITIALIZED"] = "NOT_INITIALIZED";
2582
- DevicesState["INITIALIZED"] = "INITIALIZED";
2583
- DevicesState["READY"] = "READY";
2584
- DevicesState["UPDATING"] = "UPDATING";
2585
- DevicesState["INVALID"] = "INVALID";
2586
- DevicesState["UNKNOWN"] = "UNKNOWN";
2587
- })(exports.DevicesState || (exports.DevicesState = {}));
2582
+ exports.StreamerState = void 0;
2583
+ (function (StreamerState) {
2584
+ StreamerState["NOT_INITIALIZED"] = "NOT_INITIALIZED";
2585
+ StreamerState["INITIALIZED"] = "INITIALIZED";
2586
+ StreamerState["READY"] = "READY";
2587
+ StreamerState["UPDATING"] = "UPDATING";
2588
+ StreamerState["INVALID"] = "INVALID";
2589
+ StreamerState["UNKNOWN"] = "UNKNOWN";
2590
+ })(exports.StreamerState || (exports.StreamerState = {}));
2591
+
2592
+ exports.DeviceState = void 0;
2593
+ (function (DeviceState) {
2594
+ DeviceState["NOT_INITIALIZED"] = "NOT_INITIALIZED";
2595
+ DeviceState["ENABLED"] = "ENABLED";
2596
+ DeviceState["ACCESS_DENIED"] = "ACCESS_DENIED";
2597
+ DeviceState["NOT_FOUND"] = "NOT_FOUND";
2598
+ })(exports.DeviceState || (exports.DeviceState = {}));
2588
2599
 
2589
2600
  class PlaybackController {
2590
2601
  constructor(main) {
@@ -2618,7 +2629,9 @@
2618
2629
  this._restartTimerCount = 0;
2619
2630
  this._restartTimerMaxCount = 5;
2620
2631
  this._publishState = exports.PublishState.NOT_INITIALIZED;
2621
- this._inputDeviceState = exports.DevicesState.NOT_INITIALIZED;
2632
+ this._inputDeviceState = exports.StreamerState.NOT_INITIALIZED;
2633
+ this._cameraState = exports.DeviceState.NOT_INITIALIZED;
2634
+ this._microphoneState = exports.DeviceState.NOT_INITIALIZED;
2622
2635
  this.onServerDisconnect = () => {};
2623
2636
  this.onStreamKeyTaken = () => {
2624
2637
  if (this._restartTimer != null) {
@@ -2789,7 +2802,7 @@
2789
2802
  handlePermissionChange(device, state) {
2790
2803
  return __awaiter(this, void 0, void 0, function* () {
2791
2804
  if (state === 'denied') {
2792
- this.setInputDeviceState(exports.DevicesState.INVALID);
2805
+ this.setInputDeviceState(exports.StreamerState.INVALID);
2793
2806
  if (this._publishState == exports.PublishState.PUBLISHED) {
2794
2807
  this.closeStream();
2795
2808
  }
@@ -3015,19 +3028,23 @@
3015
3028
  this._main.dispatchEvent("cameraAccessDenied", {
3016
3029
  ref: this._main
3017
3030
  });
3031
+ this._cameraState = exports.DeviceState.ACCESS_DENIED;
3018
3032
  } else if (!deviceAccess.camera.available) {
3019
3033
  this._main.dispatchEvent("noCameraFound", {
3020
3034
  ref: this._main
3021
3035
  });
3036
+ this._cameraState = exports.DeviceState.NOT_FOUND;
3022
3037
  }
3023
3038
  if (!deviceAccess.microphone.allowed) {
3024
3039
  this._main.dispatchEvent("microphoneAccessDenied", {
3025
3040
  ref: this._main
3026
3041
  });
3042
+ this._microphoneState = exports.DeviceState.ACCESS_DENIED;
3027
3043
  } else if (!deviceAccess.microphone.available) {
3028
3044
  this._main.dispatchEvent("noMicrophoneFound", {
3029
3045
  ref: this._main
3030
3046
  });
3047
+ this._microphoneState = exports.DeviceState.NOT_FOUND;
3031
3048
  }
3032
3049
  }
3033
3050
  const devices = yield navigator.mediaDevices.enumerateDevices();
@@ -3050,12 +3067,12 @@
3050
3067
  this._selectedMicrophone = this.pickMicrophone();
3051
3068
  }
3052
3069
  if (this._selectedCamera != null && this._selectedMicrophone != null) {
3053
- this.setInputDeviceState(exports.DevicesState.READY);
3070
+ this.setInputDeviceState(exports.StreamerState.READY);
3054
3071
  } else {
3055
- this.setInputDeviceState(exports.DevicesState.INVALID);
3072
+ this.setInputDeviceState(exports.StreamerState.INVALID);
3056
3073
  }
3057
3074
  } catch (error) {
3058
- this.setInputDeviceState(exports.DevicesState.INVALID);
3075
+ this.setInputDeviceState(exports.StreamerState.INVALID);
3059
3076
  this._logger.error(this, "Errror on grab devices: " + JSON.stringify(error));
3060
3077
  }
3061
3078
  this._main.dispatchEvent("deviceListUpdate", {
@@ -3082,7 +3099,8 @@
3082
3099
  selectCamera(cameraID) {
3083
3100
  var _a, _b;
3084
3101
  this._selectedCamera = null;
3085
- this.setInputDeviceState(exports.DevicesState.UPDATING);
3102
+ this.setInputDeviceState(exports.StreamerState.UPDATING);
3103
+ this._cameraState = exports.DeviceState.NOT_INITIALIZED;
3086
3104
  const streamKey = (_a = this._main.getConfigManager()) === null || _a === void 0 ? void 0 : _a.getStreamData().streamKey;
3087
3105
  const wasPublished = this._publishState === exports.PublishState.PUBLISHED;
3088
3106
  for (let i = 0; i < this._cameraList.getSize(); i++) {
@@ -3096,9 +3114,9 @@
3096
3114
  if (this._selectedCamera != null) {
3097
3115
  this._constraints.video.deviceId = this._selectedCamera.getID();
3098
3116
  if (this._selectedCamera != null && this._selectedMicrophone != null) {
3099
- this.setInputDeviceState(exports.DevicesState.READY);
3117
+ this.setInputDeviceState(exports.StreamerState.READY);
3100
3118
  } else {
3101
- this.setInputDeviceState(exports.DevicesState.INVALID);
3119
+ this.setInputDeviceState(exports.StreamerState.INVALID);
3102
3120
  }
3103
3121
  this.startCamera().then(() => {
3104
3122
  if (wasPublished && streamKey) {
@@ -3106,14 +3124,15 @@
3106
3124
  }
3107
3125
  });
3108
3126
  } else {
3109
- this.setInputDeviceState(exports.DevicesState.INVALID);
3127
+ this.setInputDeviceState(exports.StreamerState.INVALID);
3110
3128
  }
3111
3129
  }
3112
3130
  selectMicrophone(micID) {
3113
3131
  var _a, _b, _c, _d;
3114
3132
  return __awaiter(this, void 0, void 0, function* () {
3115
3133
  this._selectedMicrophone = null;
3116
- this.setInputDeviceState(exports.DevicesState.UPDATING);
3134
+ this.setInputDeviceState(exports.StreamerState.UPDATING);
3135
+ this._microphoneState = exports.DeviceState.NOT_INITIALIZED;
3117
3136
  this._logger.info(this, "Selecting microphone: " + micID);
3118
3137
  const streamKey = (_a = this._main.getConfigManager()) === null || _a === void 0 ? void 0 : _a.getStreamData().streamKey;
3119
3138
  const wasPublished = this._publishState === exports.PublishState.PUBLISHED;
@@ -3147,16 +3166,16 @@
3147
3166
  }
3148
3167
  }
3149
3168
  if (this._selectedCamera != null && this._selectedMicrophone != null) {
3150
- this.setInputDeviceState(exports.DevicesState.READY);
3169
+ this.setInputDeviceState(exports.StreamerState.READY);
3151
3170
  } else {
3152
- this.setInputDeviceState(exports.DevicesState.INVALID);
3171
+ this.setInputDeviceState(exports.StreamerState.INVALID);
3153
3172
  }
3154
3173
  if (wasPublished && streamKey) {
3155
3174
  this.publish(streamKey);
3156
3175
  }
3157
3176
  } catch (error) {
3158
3177
  console.error("Error changing microphone:", error);
3159
- this.setInputDeviceState(exports.DevicesState.INVALID);
3178
+ this.setInputDeviceState(exports.StreamerState.INVALID);
3160
3179
  this._main.dispatchEvent("inputDeviceError", {
3161
3180
  ref: this._main
3162
3181
  });
@@ -3243,12 +3262,14 @@
3243
3262
  if (this._cameraList.get(i).getID() === savedCameraID) {
3244
3263
  this._selectedCamera = this._cameraList.get(i);
3245
3264
  this._selectedCamera.setSelected(true);
3265
+ this._cameraState = exports.DeviceState.ENABLED;
3246
3266
  found = true;
3247
3267
  this._constraints.video.deviceId = this._selectedCamera.getID();
3248
3268
  break;
3249
3269
  }
3250
3270
  }
3251
3271
  if (!found) {
3272
+ this._cameraState = exports.DeviceState.NOT_FOUND;
3252
3273
  this._main.dispatchEvent("savedCameraNotFound", {
3253
3274
  ref: this._main,
3254
3275
  savedDeviceID: savedCameraID
@@ -3261,12 +3282,14 @@
3261
3282
  ref: this._main,
3262
3283
  savedDeviceID: null
3263
3284
  });
3264
- if (!((_c = this._main.getConfigManager()) === null || _c === void 0 ? void 0 : _c.getSettingsData().getIfForceSelection())) {
3285
+ if ((_c = this._main.getConfigManager()) === null || _c === void 0 ? void 0 : _c.getSettingsData().getIfForceSelection()) {
3265
3286
  this._selectedCamera = this._cameraList.get(0);
3266
3287
  this._selectedCamera.setSelected(true);
3267
3288
  (_d = this._main.getStorageManager()) === null || _d === void 0 ? void 0 : _d.saveField("cameraID", this._selectedCamera.getID());
3268
3289
  this._constraints.video.deviceId = this._selectedCamera.getID();
3290
+ this._cameraState = exports.DeviceState.ENABLED;
3269
3291
  } else {
3292
+ this._cameraState = exports.DeviceState.NOT_FOUND;
3270
3293
  return null;
3271
3294
  }
3272
3295
  }
@@ -3291,6 +3314,7 @@
3291
3314
  if (this._microphoneList.get(i).getID() === savedMicID) {
3292
3315
  this._selectedMicrophone = this._microphoneList.get(i);
3293
3316
  found = true;
3317
+ this._microphoneState = exports.DeviceState.ENABLED;
3294
3318
  break;
3295
3319
  }
3296
3320
  }
@@ -3299,6 +3323,7 @@
3299
3323
  ref: this._main,
3300
3324
  savedDeviceID: savedMicID
3301
3325
  });
3326
+ this._microphoneState = exports.DeviceState.NOT_FOUND;
3302
3327
  return null;
3303
3328
  }
3304
3329
  }
@@ -3307,10 +3332,12 @@
3307
3332
  ref: this._main,
3308
3333
  savedDeviceID: null
3309
3334
  });
3310
- if (!((_c = this._main.getConfigManager()) === null || _c === void 0 ? void 0 : _c.getSettingsData().getIfForceSelection())) {
3335
+ if ((_c = this._main.getConfigManager()) === null || _c === void 0 ? void 0 : _c.getSettingsData().getIfForceSelection()) {
3311
3336
  this._selectedMicrophone = this._microphoneList.get(0);
3337
+ this._microphoneState = exports.DeviceState.ENABLED;
3312
3338
  (_d = this._main.getStorageManager()) === null || _d === void 0 ? void 0 : _d.saveField("microphoneID", this._selectedMicrophone.getID());
3313
3339
  } else {
3340
+ this._microphoneState = exports.DeviceState.NOT_FOUND;
3314
3341
  return null;
3315
3342
  }
3316
3343
  }
@@ -3408,6 +3435,12 @@
3408
3435
  selectedMicrophone: this._selectedMicrophone
3409
3436
  });
3410
3437
  }
3438
+ getCamerState() {
3439
+ return this._cameraState;
3440
+ }
3441
+ getMicrophoneState() {
3442
+ return this._microphoneState;
3443
+ }
3411
3444
  getCameraList() {
3412
3445
  return this._cameraList != null ? this._cameraList.getArray() : [];
3413
3446
  }
@@ -3817,8 +3850,8 @@
3817
3850
  constructor(streamConfig, autoInitialize = false) {
3818
3851
  super();
3819
3852
  this.DEV_MODE = true;
3820
- this.STREAMER_VERSION = "0.9.0-beta.7";
3821
- this.COMPILE_DATE = "1/2/2025, 1:53:45 AM";
3853
+ this.STREAMER_VERSION = "0.9.0-beta.9";
3854
+ this.COMPILE_DATE = "1/7/2025, 3:11:22 PM";
3822
3855
  this.STREAMER_BRANCH = "Experimental";
3823
3856
  this.STREAMER_PROTOCOL_VERSION = 1;
3824
3857
  this._initialized = false;
@@ -3975,9 +4008,17 @@
3975
4008
  console.log("gonzo daje publish");
3976
4009
  return (_b = (_a = this._playbackController) === null || _a === void 0 ? void 0 : _a.publish(streamKey)) !== null && _b !== void 0 ? _b : false;
3977
4010
  }
3978
- getDeviceState() {
4011
+ getStreamerState() {
4012
+ var _a, _b;
4013
+ return (_b = (_a = this._playbackController) === null || _a === void 0 ? void 0 : _a.getInputDeviceState()) !== null && _b !== void 0 ? _b : exports.StreamerState.NOT_INITIALIZED;
4014
+ }
4015
+ getCamerState() {
4016
+ var _a, _b;
4017
+ return (_b = (_a = this._playbackController) === null || _a === void 0 ? void 0 : _a.getCamerState()) !== null && _b !== void 0 ? _b : exports.DeviceState.NOT_INITIALIZED;
4018
+ }
4019
+ getMicrophoneState() {
3979
4020
  var _a, _b;
3980
- return (_b = (_a = this._playbackController) === null || _a === void 0 ? void 0 : _a.getInputDeviceState()) !== null && _b !== void 0 ? _b : exports.DevicesState.NOT_INITIALIZED;
4021
+ return (_b = (_a = this._playbackController) === null || _a === void 0 ? void 0 : _a.getMicrophoneState()) !== null && _b !== void 0 ? _b : exports.DeviceState.NOT_INITIALIZED;
3981
4022
  }
3982
4023
  clearSavedDevices() {
3983
4024
  var _a;