@stormstreaming/stormstreamer 0.9.0-beta.6 → 0.9.0-beta.8

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.6
8
- * Version: 12/10/2024, 1:21:58 PM
7
+ * Version: 0.9.0-beta.8
8
+ * Version: 1/7/2025, 3:10:22 PM
9
9
  *
10
10
  * LEGAL NOTICE:
11
11
  * This software is subject to the terms and conditions defined in
@@ -578,7 +578,7 @@
578
578
  this.startOnDOMReady = false;
579
579
  this.iOSOnDomReadyFix = true;
580
580
  this._restartOnFocus = true;
581
- this._forceDeviceSelection = false;
581
+ this._preselectDevices = true;
582
582
  this.parse(config);
583
583
  }
584
584
  parse(config) {
@@ -589,7 +589,7 @@
589
589
  this._restartOnFocus = (_c = this._settingsConfig.restartOnFocus) !== null && _c !== void 0 ? _c : this._restartOnFocus;
590
590
  this._restartOnError = (_d = this._settingsConfig.restartOnError) !== null && _d !== void 0 ? _d : this._restartOnError;
591
591
  this._reconnectTime = (_e = this._settingsConfig.reconnectTime) !== null && _e !== void 0 ? _e : this._reconnectTime;
592
- this._forceDeviceSelection = (_f = !this._settingsConfig.preselectDevices) !== null && _f !== void 0 ? _f : this._forceDeviceSelection;
592
+ this._preselectDevices = (_f = this._settingsConfig.preselectDevices) !== null && _f !== void 0 ? _f : this._preselectDevices;
593
593
  this._videoData = new VideoData((_g = this._settingsConfig.video) !== null && _g !== void 0 ? _g : null);
594
594
  this._audioData = new AudioData((_h = this._settingsConfig.audio) !== null && _h !== void 0 ? _h : null);
595
595
  this._storageData = new StorageData((_j = this._settingsConfig.storage) !== null && _j !== void 0 ? _j : null);
@@ -626,7 +626,7 @@
626
626
  return this._debugData;
627
627
  }
628
628
  getIfForceSelection() {
629
- return this._forceDeviceSelection;
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
+ var DeviceState;
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
+ })(DeviceState || (DeviceState = {}));
2588
2599
 
2589
2600
  class PlaybackController {
2590
2601
  constructor(main) {
@@ -2615,41 +2626,77 @@
2615
2626
  },
2616
2627
  audio: true
2617
2628
  };
2629
+ this._restartTimerCount = 0;
2630
+ this._restartTimerMaxCount = 5;
2618
2631
  this._publishState = exports.PublishState.NOT_INITIALIZED;
2619
- this._inputDeviceState = exports.DevicesState.NOT_INITIALIZED;
2632
+ this._inputDeviceState = exports.StreamerState.NOT_INITIALIZED;
2633
+ this._cameraState = DeviceState.NOT_INITIALIZED;
2634
+ this._microphoneState = DeviceState.NOT_INITIALIZED;
2620
2635
  this.onServerDisconnect = () => {};
2636
+ this.onStreamKeyTaken = () => {
2637
+ if (this._restartTimer != null) {
2638
+ clearInterval(this._restartTimer);
2639
+ this._restartTimerCount = 0;
2640
+ }
2641
+ this._logger.info(this, "WebRTCStreamer :: Starting StreamKeyTaken Interval");
2642
+ this._restartTimer = setInterval(() => {
2643
+ var _a, _b;
2644
+ if (this._restartTimer != null) {
2645
+ if (this._restartTimerCount < this._restartTimerMaxCount) {
2646
+ this._logger.info(this, "WebRTCStreamer :: StreamKeyTaken Interval: " + this._restartTimerCount + "/" + this._restartTimerMaxCount);
2647
+ this._restartTimerCount++;
2648
+ } else {
2649
+ clearInterval(this._restartTimer);
2650
+ this._restartTimer = null;
2651
+ this._restartTimerCount = 0;
2652
+ const streamData = (_a = this._main.getConfigManager()) === null || _a === void 0 ? void 0 : _a.getStreamData();
2653
+ const streamKey = streamData === null || streamData === void 0 ? void 0 : streamData.streamKey;
2654
+ if (streamKey != null) {
2655
+ const prevStreamKey = streamKey;
2656
+ this.publish(prevStreamKey);
2657
+ }
2658
+ }
2659
+ const usedStreamKey = (_b = this._main.getConfigManager().getStreamData().streamKey) !== null && _b !== void 0 ? _b : "unknown";
2660
+ this._main.dispatchEvent("streamKeyInUseInterval", {
2661
+ ref: this._main,
2662
+ streamKey: usedStreamKey,
2663
+ count: this._restartTimerCount,
2664
+ maxCount: this._restartTimerMaxCount
2665
+ });
2666
+ }
2667
+ }, 1000);
2668
+ };
2621
2669
  this.onServerConnect = () => {
2622
2670
  if (this._peerConnection) {
2623
2671
  this.closeWebRTCConnection();
2624
2672
  }
2625
2673
  this._peerConnection = new RTCPeerConnection(this._peerConnectionConfig);
2674
+ if (this._stream) {
2675
+ let localTracks = this._stream.getTracks();
2676
+ for (let localTrack in localTracks) {
2677
+ this._peerConnection.addTrack(localTracks[localTrack], this._stream);
2678
+ }
2679
+ }
2626
2680
  this._peerConnection.onicecandidate = event => {
2627
2681
  this.onIceCandidate(event);
2628
2682
  };
2629
2683
  this._peerConnection.onconnectionstatechange = event => {
2630
2684
  this.onConnectionStateChange(event);
2631
2685
  };
2632
- this._peerConnection.onnegotiationneeded = event => {
2686
+ this._peerConnection.onnegotiationneeded = event => __awaiter(this, void 0, void 0, function* () {
2633
2687
  if (this._peerConnection) {
2634
- this._peerConnection.createOffer(description => {
2635
- this.onDescriptionSuccess(description);
2636
- }, error => {
2688
+ try {
2689
+ const description = yield this._peerConnection.createOffer();
2690
+ yield this.onDescriptionSuccess(description);
2691
+ } catch (error) {
2637
2692
  this.onDescriptionError(error);
2638
- }).catch(reason => {
2639
- console.log(reason);
2640
- });
2641
- }
2642
- };
2643
- if (this._stream) {
2644
- let localTracks = this._stream.getTracks();
2645
- for (let localTrack in localTracks) {
2646
- this._peerConnection.addTrack(localTracks[localTrack], this._stream);
2693
+ console.error('Error creating offer:', error);
2694
+ }
2647
2695
  }
2648
- }
2696
+ });
2649
2697
  };
2650
2698
  this.onDescriptionSuccess = description => {
2651
2699
  var _a, _b, _c;
2652
- console.log('%c⏵ 🎥 onDescriptionSuccess ', 'background: green; color: white;');
2653
2700
  const streamInfo = {
2654
2701
  applicationName: (_b = (_a = this._main.getNetworkController()) === null || _a === void 0 ? void 0 : _a.getConnection().getCurrentServer()) === null || _b === void 0 ? void 0 : _b.getApplication(),
2655
2702
  streamName: (_c = this._main.getConfigManager()) === null || _c === void 0 ? void 0 : _c.getStreamData().streamKey,
@@ -2700,6 +2747,7 @@
2700
2747
  var _a, _b;
2701
2748
  this._main.addEventListener("serverConnect", this.onServerConnect, false);
2702
2749
  this._main.addEventListener("serverDisconnect", this.onServerDisconnect, false);
2750
+ this._main.addEventListener("streamKeyInUse", this.onStreamKeyTaken, false);
2703
2751
  document.addEventListener("visibilitychange", this.visibilityChange);
2704
2752
  window.addEventListener("blur", this.onWindowBlur);
2705
2753
  window.addEventListener("focus", this.onWindowFocus);
@@ -2754,7 +2802,7 @@
2754
2802
  handlePermissionChange(device, state) {
2755
2803
  return __awaiter(this, void 0, void 0, function* () {
2756
2804
  if (state === 'denied') {
2757
- this.setInputDeviceState(exports.DevicesState.INVALID);
2805
+ this.setInputDeviceState(exports.StreamerState.INVALID);
2758
2806
  if (this._publishState == exports.PublishState.PUBLISHED) {
2759
2807
  this.closeStream();
2760
2808
  }
@@ -2808,6 +2856,7 @@
2808
2856
  this._logger.warning(this, "Cannot publish - stream not ready (missing video or audio track)");
2809
2857
  return false;
2810
2858
  }
2859
+ this._logger.info(this, "Publish: " + streamKey);
2811
2860
  this.closeWebRTCConnection();
2812
2861
  this._main.getConfigManager().getStreamData().streamKey = streamKey;
2813
2862
  this._main.dispatchEvent("publish", {
@@ -2855,7 +2904,6 @@
2855
2904
  console.error("Error checking device availability:", error);
2856
2905
  }
2857
2906
  if (isFirefox) {
2858
- console.log("Firefox detected, using direct getUserMedia check...");
2859
2907
  if (results.camera.available) {
2860
2908
  try {
2861
2909
  const stream = yield navigator.mediaDevices.getUserMedia({
@@ -2864,7 +2912,7 @@
2864
2912
  results.camera.allowed = true;
2865
2913
  stream.getTracks().forEach(track => track.stop());
2866
2914
  } catch (e) {
2867
- console.log("Camera permission check failed:", e);
2915
+ this._logger.error(this, "Camera permission check failed: " + JSON.stringify(e));
2868
2916
  results.camera.allowed = false;
2869
2917
  }
2870
2918
  }
@@ -2876,7 +2924,7 @@
2876
2924
  results.microphone.allowed = true;
2877
2925
  stream.getTracks().forEach(track => track.stop());
2878
2926
  } catch (e) {
2879
- console.log("Microphone permission check failed:", e);
2927
+ this._logger.error(this, "Microphone permission check failed: " + JSON.stringify(e));
2880
2928
  results.microphone.allowed = false;
2881
2929
  }
2882
2930
  }
@@ -2903,22 +2951,23 @@
2903
2951
  }
2904
2952
  stream.getTracks().forEach(track => track.stop());
2905
2953
  } catch (error) {
2906
- console.log("Additional permission check failed:", error);
2954
+ this._logger.error(this, "Additional permission check failed " + JSON.stringify(error));
2907
2955
  }
2908
2956
  }
2909
2957
  } catch (error) {
2910
- console.error("Error checking permissions:", error);
2958
+ this._logger.error(this, "Error checking permissions " + JSON.stringify(error));
2911
2959
  }
2912
2960
  }
2913
2961
  return results;
2914
2962
  });
2915
2963
  }
2916
2964
  onSocketMessage(data) {
2965
+ var _a;
2917
2966
  let msgJSON = JSON.parse(data);
2918
2967
  let msgStatus = Number(msgJSON["status"]);
2919
2968
  switch (msgStatus) {
2920
2969
  case 200:
2921
- console.log('%c⏵ 🎥 onSocketMessage: 200', 'background: green; color: white;');
2970
+ this._logger.info(this, "SDP Exchange Successful");
2922
2971
  let sdpData = msgJSON['sdp'];
2923
2972
  if (sdpData !== undefined) {
2924
2973
  this._peerConnection.setRemoteDescription(new RTCSessionDescription(sdpData), () => {}, () => {});
@@ -2931,17 +2980,18 @@
2931
2980
  }
2932
2981
  break;
2933
2982
  case 503:
2934
- console.log('%c⏵ 🎥 onSocketMessage: 503', 'background: green; color: white;');
2983
+ this._logger.error(this, "StreamKey already use");
2984
+ const usedStreamKey = (_a = this._main.getConfigManager().getStreamData().streamKey) !== null && _a !== void 0 ? _a : "unknown";
2935
2985
  this._main.dispatchEvent("streamKeyInUse", {
2936
2986
  ref: this._main,
2937
- streamKey: this._main.getConfigManager().getStreamData().streamKey
2987
+ streamKey: usedStreamKey
2938
2988
  });
2939
2989
  this.setPublishState(exports.PublishState.ERROR);
2940
2990
  break;
2941
2991
  }
2942
2992
  }
2943
2993
  onConnectionStateChange(event) {
2944
- console.log('%c⏵ 🎥 onConnectionStateChange: ' + event.currentTarget.connectionState, 'background: green; color: white;');
2994
+ this._logger.info(this, "Connection State Change: " + JSON.stringify(event));
2945
2995
  if (event !== null) {
2946
2996
  switch (event.currentTarget.connectionState) {
2947
2997
  case "connecting":
@@ -2978,19 +3028,23 @@
2978
3028
  this._main.dispatchEvent("cameraAccessDenied", {
2979
3029
  ref: this._main
2980
3030
  });
3031
+ this._cameraState = DeviceState.ACCESS_DENIED;
2981
3032
  } else if (!deviceAccess.camera.available) {
2982
3033
  this._main.dispatchEvent("noCameraFound", {
2983
3034
  ref: this._main
2984
3035
  });
3036
+ this._cameraState = DeviceState.NOT_FOUND;
2985
3037
  }
2986
3038
  if (!deviceAccess.microphone.allowed) {
2987
3039
  this._main.dispatchEvent("microphoneAccessDenied", {
2988
3040
  ref: this._main
2989
3041
  });
3042
+ this._microphoneState = DeviceState.ACCESS_DENIED;
2990
3043
  } else if (!deviceAccess.microphone.available) {
2991
3044
  this._main.dispatchEvent("noMicrophoneFound", {
2992
3045
  ref: this._main
2993
3046
  });
3047
+ this._microphoneState = DeviceState.NOT_FOUND;
2994
3048
  }
2995
3049
  }
2996
3050
  const devices = yield navigator.mediaDevices.enumerateDevices();
@@ -3013,12 +3067,12 @@
3013
3067
  this._selectedMicrophone = this.pickMicrophone();
3014
3068
  }
3015
3069
  if (this._selectedCamera != null && this._selectedMicrophone != null) {
3016
- this.setInputDeviceState(exports.DevicesState.READY);
3070
+ this.setInputDeviceState(exports.StreamerState.READY);
3017
3071
  } else {
3018
- this.setInputDeviceState(exports.DevicesState.INVALID);
3072
+ this.setInputDeviceState(exports.StreamerState.INVALID);
3019
3073
  }
3020
3074
  } catch (error) {
3021
- this.setInputDeviceState(exports.DevicesState.INVALID);
3075
+ this.setInputDeviceState(exports.StreamerState.INVALID);
3022
3076
  this._logger.error(this, "Errror on grab devices: " + JSON.stringify(error));
3023
3077
  }
3024
3078
  this._main.dispatchEvent("deviceListUpdate", {
@@ -3045,13 +3099,13 @@
3045
3099
  selectCamera(cameraID) {
3046
3100
  var _a, _b;
3047
3101
  this._selectedCamera = null;
3048
- this.setInputDeviceState(exports.DevicesState.UPDATING);
3102
+ this.setInputDeviceState(exports.StreamerState.UPDATING);
3103
+ this._cameraState = DeviceState.NOT_INITIALIZED;
3049
3104
  const streamKey = (_a = this._main.getConfigManager()) === null || _a === void 0 ? void 0 : _a.getStreamData().streamKey;
3050
3105
  const wasPublished = this._publishState === exports.PublishState.PUBLISHED;
3051
3106
  for (let i = 0; i < this._cameraList.getSize(); i++) {
3052
3107
  if (this._cameraList.get(i).getID() == cameraID) {
3053
3108
  this._selectedCamera = this._cameraList.get(i);
3054
- console.log("kamera znaleziona i zapisana " + this._cameraList.get(i).getLabel() + " " + this._cameraList.get(i).getID());
3055
3109
  (_b = this._main.getStorageManager()) === null || _b === void 0 ? void 0 : _b.saveField("cameraID", this._selectedCamera.getID());
3056
3110
  break;
3057
3111
  }
@@ -3060,9 +3114,9 @@
3060
3114
  if (this._selectedCamera != null) {
3061
3115
  this._constraints.video.deviceId = this._selectedCamera.getID();
3062
3116
  if (this._selectedCamera != null && this._selectedMicrophone != null) {
3063
- this.setInputDeviceState(exports.DevicesState.READY);
3117
+ this.setInputDeviceState(exports.StreamerState.READY);
3064
3118
  } else {
3065
- this.setInputDeviceState(exports.DevicesState.INVALID);
3119
+ this.setInputDeviceState(exports.StreamerState.INVALID);
3066
3120
  }
3067
3121
  this.startCamera().then(() => {
3068
3122
  if (wasPublished && streamKey) {
@@ -3070,15 +3124,16 @@
3070
3124
  }
3071
3125
  });
3072
3126
  } else {
3073
- this.setInputDeviceState(exports.DevicesState.INVALID);
3127
+ this.setInputDeviceState(exports.StreamerState.INVALID);
3074
3128
  }
3075
3129
  }
3076
3130
  selectMicrophone(micID) {
3077
3131
  var _a, _b, _c, _d;
3078
3132
  return __awaiter(this, void 0, void 0, function* () {
3079
3133
  this._selectedMicrophone = null;
3080
- this.setInputDeviceState(exports.DevicesState.UPDATING);
3081
- console.log("🎤 Selecting microphone:", micID);
3134
+ this.setInputDeviceState(exports.StreamerState.UPDATING);
3135
+ this._microphoneState = DeviceState.NOT_INITIALIZED;
3136
+ this._logger.info(this, "Selecting microphone: " + micID);
3082
3137
  const streamKey = (_a = this._main.getConfigManager()) === null || _a === void 0 ? void 0 : _a.getStreamData().streamKey;
3083
3138
  const wasPublished = this._publishState === exports.PublishState.PUBLISHED;
3084
3139
  for (let i = 0; i < this._microphoneList.getSize(); i++) {
@@ -3111,16 +3166,16 @@
3111
3166
  }
3112
3167
  }
3113
3168
  if (this._selectedCamera != null && this._selectedMicrophone != null) {
3114
- this.setInputDeviceState(exports.DevicesState.READY);
3169
+ this.setInputDeviceState(exports.StreamerState.READY);
3115
3170
  } else {
3116
- this.setInputDeviceState(exports.DevicesState.INVALID);
3171
+ this.setInputDeviceState(exports.StreamerState.INVALID);
3117
3172
  }
3118
3173
  if (wasPublished && streamKey) {
3119
3174
  this.publish(streamKey);
3120
3175
  }
3121
3176
  } catch (error) {
3122
3177
  console.error("Error changing microphone:", error);
3123
- this.setInputDeviceState(exports.DevicesState.INVALID);
3178
+ this.setInputDeviceState(exports.StreamerState.INVALID);
3124
3179
  this._main.dispatchEvent("inputDeviceError", {
3125
3180
  ref: this._main
3126
3181
  });
@@ -3130,7 +3185,6 @@
3130
3185
  startCamera() {
3131
3186
  return __awaiter(this, void 0, void 0, function* () {
3132
3187
  if (this._stream) {
3133
- console.log("Stopping existing stream before starting new one");
3134
3188
  this._stream.getTracks().forEach(track => {
3135
3189
  track.stop();
3136
3190
  });
@@ -3208,12 +3262,14 @@
3208
3262
  if (this._cameraList.get(i).getID() === savedCameraID) {
3209
3263
  this._selectedCamera = this._cameraList.get(i);
3210
3264
  this._selectedCamera.setSelected(true);
3265
+ this._cameraState = DeviceState.ENABLED;
3211
3266
  found = true;
3212
3267
  this._constraints.video.deviceId = this._selectedCamera.getID();
3213
3268
  break;
3214
3269
  }
3215
3270
  }
3216
3271
  if (!found) {
3272
+ this._cameraState = DeviceState.NOT_FOUND;
3217
3273
  this._main.dispatchEvent("savedCameraNotFound", {
3218
3274
  ref: this._main,
3219
3275
  savedDeviceID: savedCameraID
@@ -3226,12 +3282,14 @@
3226
3282
  ref: this._main,
3227
3283
  savedDeviceID: null
3228
3284
  });
3229
- 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()) {
3230
3286
  this._selectedCamera = this._cameraList.get(0);
3231
3287
  this._selectedCamera.setSelected(true);
3232
3288
  (_d = this._main.getStorageManager()) === null || _d === void 0 ? void 0 : _d.saveField("cameraID", this._selectedCamera.getID());
3233
3289
  this._constraints.video.deviceId = this._selectedCamera.getID();
3290
+ this._cameraState = DeviceState.ENABLED;
3234
3291
  } else {
3292
+ this._cameraState = DeviceState.NOT_FOUND;
3235
3293
  return null;
3236
3294
  }
3237
3295
  }
@@ -3256,6 +3314,7 @@
3256
3314
  if (this._microphoneList.get(i).getID() === savedMicID) {
3257
3315
  this._selectedMicrophone = this._microphoneList.get(i);
3258
3316
  found = true;
3317
+ this._microphoneState = DeviceState.ENABLED;
3259
3318
  break;
3260
3319
  }
3261
3320
  }
@@ -3264,6 +3323,7 @@
3264
3323
  ref: this._main,
3265
3324
  savedDeviceID: savedMicID
3266
3325
  });
3326
+ this._microphoneState = DeviceState.NOT_FOUND;
3267
3327
  return null;
3268
3328
  }
3269
3329
  }
@@ -3272,10 +3332,12 @@
3272
3332
  ref: this._main,
3273
3333
  savedDeviceID: null
3274
3334
  });
3275
- 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()) {
3276
3336
  this._selectedMicrophone = this._microphoneList.get(0);
3337
+ this._microphoneState = DeviceState.ENABLED;
3277
3338
  (_d = this._main.getStorageManager()) === null || _d === void 0 ? void 0 : _d.saveField("microphoneID", this._selectedMicrophone.getID());
3278
3339
  } else {
3340
+ this._microphoneState = DeviceState.NOT_FOUND;
3279
3341
  return null;
3280
3342
  }
3281
3343
  }
@@ -3357,7 +3419,7 @@
3357
3419
  return this._selectedMicrophone;
3358
3420
  }
3359
3421
  setPublishState(newState) {
3360
- console.log('%c⏵ 🎥 setPublishState: ' + newState, 'background: green; color: white;');
3422
+ this._logger.info(this, "Publish State: " + newState);
3361
3423
  this._publishState = newState;
3362
3424
  this._main.dispatchEvent("publishStateChange", {
3363
3425
  ref: this._main,
@@ -3365,7 +3427,6 @@
3365
3427
  });
3366
3428
  }
3367
3429
  setInputDeviceState(newState) {
3368
- console.log('%c⏵ 🎥 setInputDeviceState: ' + newState, 'background: green; color: white;');
3369
3430
  this._inputDeviceState = newState;
3370
3431
  this._main.dispatchEvent("deviceStateChange", {
3371
3432
  ref: this._main,
@@ -3374,6 +3435,12 @@
3374
3435
  selectedMicrophone: this._selectedMicrophone
3375
3436
  });
3376
3437
  }
3438
+ getCamerState() {
3439
+ return this._cameraState;
3440
+ }
3441
+ getMicrophoneState() {
3442
+ return this._microphoneState;
3443
+ }
3377
3444
  getCameraList() {
3378
3445
  return this._cameraList != null ? this._cameraList.getArray() : [];
3379
3446
  }
@@ -3403,7 +3470,6 @@
3403
3470
  }
3404
3471
  forceStopAllStreams() {
3405
3472
  var _a, _b;
3406
- console.log("Force stopping all streams...");
3407
3473
  if (this._peerConnection) {
3408
3474
  try {
3409
3475
  const senders = this._peerConnection.getSenders();
@@ -3447,13 +3513,10 @@
3447
3513
  if (this._stream) {
3448
3514
  try {
3449
3515
  const tracks = this._stream.getTracks();
3450
- console.log(`Stopping ${tracks.length} tracks from main stream`);
3451
3516
  tracks.forEach(track => {
3452
3517
  try {
3453
- console.log(`Stopping ${track.kind} track, enabled: ${track.enabled}, state: ${track.readyState}`);
3454
3518
  track.enabled = false;
3455
3519
  track.stop();
3456
- console.log(`Track after stop - state: ${track.readyState}`);
3457
3520
  } catch (e) {
3458
3521
  console.error(`Error stopping ${track.kind} track:`, e);
3459
3522
  }
@@ -3463,10 +3526,8 @@
3463
3526
  console.error('Error stopping main stream:', e);
3464
3527
  }
3465
3528
  }
3466
- console.log("All streams should be stopped now");
3467
3529
  }
3468
3530
  destroy() {
3469
- console.log("Starting destroy process...");
3470
3531
  this.forceStopAllStreams();
3471
3532
  if (this._soundMeter) {
3472
3533
  this._soundMeter.detach();
@@ -3487,7 +3548,7 @@
3487
3548
  console.error('Error removing event listeners:', e);
3488
3549
  }
3489
3550
  this._publishState = exports.PublishState.NOT_INITIALIZED;
3490
- console.log("Destroy process completed");
3551
+ if (this._restartTimer != null) clearInterval(this._restartTimer);
3491
3552
  }
3492
3553
  }
3493
3554
 
@@ -3789,8 +3850,8 @@
3789
3850
  constructor(streamConfig, autoInitialize = false) {
3790
3851
  super();
3791
3852
  this.DEV_MODE = true;
3792
- this.STREAMER_VERSION = "0.9.0-beta.6";
3793
- this.COMPILE_DATE = "12/10/2024, 1:21:57 PM";
3853
+ this.STREAMER_VERSION = "0.9.0-beta.8";
3854
+ this.COMPILE_DATE = "1/7/2025, 3:10:20 PM";
3794
3855
  this.STREAMER_BRANCH = "Experimental";
3795
3856
  this.STREAMER_PROTOCOL_VERSION = 1;
3796
3857
  this._initialized = false;
@@ -3944,11 +4005,20 @@
3944
4005
  }
3945
4006
  publish(streamKey) {
3946
4007
  var _a, _b;
4008
+ console.log("gonzo daje publish");
3947
4009
  return (_b = (_a = this._playbackController) === null || _a === void 0 ? void 0 : _a.publish(streamKey)) !== null && _b !== void 0 ? _b : false;
3948
4010
  }
3949
- 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 : DeviceState.NOT_INITIALIZED;
4018
+ }
4019
+ getMicrophoneState() {
3950
4020
  var _a, _b;
3951
- 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 : DeviceState.NOT_INITIALIZED;
3952
4022
  }
3953
4023
  clearSavedDevices() {
3954
4024
  var _a;