@stormstreaming/stormstreamer 0.9.0-beta.0 → 0.9.0-beta.2

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.0
8
- * Version: 11/28/2024, 9:22:54 AM
7
+ * Version: 0.9.0-beta.2
8
+ * Version: 11/29/2024, 6:55:47 PM
9
9
  *
10
10
  * LEGAL NOTICE:
11
11
  * This software is subject to the terms and conditions defined in
@@ -1758,10 +1758,10 @@
1758
1758
  const containerID = (_d = (_c = (_b = (_a = this._main.getConfigManager()) === null || _a === void 0 ? void 0 : _a.getSettingsData()) === null || _b === void 0 ? void 0 : _b.getVideoData()) === null || _c === void 0 ? void 0 : _c.containerID) !== null && _d !== void 0 ? _d : null;
1759
1759
  this._scalingMode = (_f = (_e = this._main.getConfigManager()) === null || _e === void 0 ? void 0 : _e.getSettingsData().getVideoData().scalingMode) !== null && _f !== void 0 ? _f : ScalingType.FILL;
1760
1760
  this._videoContainer = document.createElement('div');
1761
- this._videoContainer.setAttribute("id", "stormLibrary_" + this._main.getStreamerID());
1761
+ this._videoContainer.setAttribute("id", "stormStreamer_" + this._main.getStreamerID());
1762
1762
  this._videoContainer.style.overflow = "hidden";
1763
1763
  this._videoContainer.style.position = "relative";
1764
- this._videoContainer.classList.add("stormLibrary");
1764
+ this._videoContainer.classList.add("stormStreamer");
1765
1765
  this._screenElement = new ScreenElement(this._main);
1766
1766
  this._videoContainer.appendChild(this._screenElement.getVideoElement());
1767
1767
  const debounceValue = this._main.getConfigManager().getSettingsData().getVideoData().resizeDebounce;
@@ -1789,9 +1789,11 @@
1789
1789
  attachToParent(container) {
1790
1790
  let result = false;
1791
1791
  let tempParentElement = null;
1792
+ console.log("xxxxxxxxx", container);
1792
1793
  if (typeof container === "string") {
1793
1794
  this._logger.info(this, "Attaching container to ID: " + container);
1794
1795
  tempParentElement = document.getElementById(container);
1796
+ console.log(">>", document.getElementById(container));
1795
1797
  } else if (container instanceof HTMLElement) {
1796
1798
  this._logger.info(this, "Attaching container to HTMLElement: " + container);
1797
1799
  tempParentElement = container;
@@ -1814,6 +1816,8 @@
1814
1816
  this.onResize();
1815
1817
  result = true;
1816
1818
  } else {
1819
+ console.log("tempParentElement", tempParentElement);
1820
+ console.log("this._videoContainer", this._videoContainer);
1817
1821
  this._logger.warning(this, "attachToParent :: container was not found");
1818
1822
  }
1819
1823
  return result;
@@ -2443,7 +2447,6 @@
2443
2447
  this._instant = Math.sqrt(sum / input.length);
2444
2448
  this._slow = 0.05 * this._instant + 0.95 * this._slow;
2445
2449
  this.clip = clipcount / input.length;
2446
- console.log("sound", this._instant, this._slow);
2447
2450
  this._main.dispatchEvent("soundMeter", {
2448
2451
  ref: this._main,
2449
2452
  high: this._instant,
@@ -2505,6 +2508,7 @@
2505
2508
  };
2506
2509
  this.onDescriptionSuccess = description => {
2507
2510
  var _a, _b, _c;
2511
+ console.log('%cāµ šŸŽ„ onDescriptionSuccess ', 'background: green; color: white;');
2508
2512
  const streamInfo = {
2509
2513
  applicationName: (_b = (_a = this._main.getNetworkController()) === null || _a === void 0 ? void 0 : _a.getConnection().getCurrentServer()) === null || _b === void 0 ? void 0 : _b.getApplication(),
2510
2514
  streamName: (_c = this._main.getConfigManager()) === null || _c === void 0 ? void 0 : _c.getStreamData().streamKey,
@@ -2592,6 +2596,7 @@
2592
2596
  }
2593
2597
  onUserMediaSuccess(stream) {
2594
2598
  var _a;
2599
+ console.log('%cāµ šŸŽ„ onUserMediaSuccess', 'background: green; color: white;');
2595
2600
  this._logger.success(this, "WebRTCStreamer :: WebRTC UserMedia successfully retrieved");
2596
2601
  this._stream = stream;
2597
2602
  this._soundMeter.attach(this._stream);
@@ -2601,9 +2606,12 @@
2601
2606
  videoElement.srcObject = stream;
2602
2607
  videoElement.autoplay = true;
2603
2608
  videoElement.playsInline = true;
2609
+ videoElement.disableRemotePlayback = true;
2610
+ videoElement.controls = false;
2604
2611
  (_a = this._main.getNetworkController()) === null || _a === void 0 ? void 0 : _a.start();
2605
2612
  }
2606
2613
  onUserMediaError(error) {
2614
+ console.log('%cāµ šŸŽ„ onUserMediaError: ' + JSON.stringify(error), 'background: green; color: white;');
2607
2615
  switch (error.message) {
2608
2616
  case "Permission denied":
2609
2617
  this._logger.warning(this, "WebRTCStreamer :: No permission to access camera & microphone");
@@ -2645,6 +2653,7 @@
2645
2653
  let msgStatus = Number(msgJSON["status"]);
2646
2654
  switch (msgStatus) {
2647
2655
  case 200:
2656
+ console.log('%cāµ šŸŽ„ onSocketMessage: 200', 'background: green; color: white;');
2648
2657
  let sdpData = msgJSON['sdp'];
2649
2658
  if (sdpData !== undefined) {
2650
2659
  this._peerConnection.setRemoteDescription(new RTCSessionDescription(sdpData), () => {}, () => {});
@@ -2657,6 +2666,7 @@
2657
2666
  }
2658
2667
  break;
2659
2668
  case 503:
2669
+ console.log('%cāµ šŸŽ„ onSocketMessage: 503', 'background: green; color: white;');
2660
2670
  this._main.dispatchEvent("streamKeyInUse", {
2661
2671
  ref: this._main,
2662
2672
  streamKey: this._main.getConfigManager().getStreamData().streamKey
@@ -2666,6 +2676,7 @@
2666
2676
  }
2667
2677
  }
2668
2678
  onConnectionStateChange(event) {
2679
+ console.log('%cāµ šŸŽ„ onConnectionStateChange: ' + event.currentTarget.connectionState, 'background: green; color: white;');
2669
2680
  if (event !== null) {
2670
2681
  switch (event.currentTarget.connectionState) {
2671
2682
  case "connecting":
@@ -2675,7 +2686,7 @@
2675
2686
  case "connected":
2676
2687
  this._logger.info(this, "WebRTCStreamer :: Event: onStreamerConnected");
2677
2688
  this.setPublishState(exports.PublishState.PUBLISHED);
2678
- if (this._isMicrophoneMuted == true) this.muteMicrophone(false);
2689
+ this.muteMicrophone(this._isMicrophoneMuted);
2679
2690
  break;
2680
2691
  case "disconnected":
2681
2692
  this._logger.info(this, "WebRTCStreamer :: Event: onStreamerDisconnected");
@@ -2713,7 +2724,7 @@
2713
2724
  ref: this._main
2714
2725
  });
2715
2726
  } else if (this._microphoneList.getSize() == 0) {
2716
- this._main.dispatchEvent("noCameraFound", {
2727
+ this._main.dispatchEvent("noMicrophoneFound", {
2717
2728
  ref: this._main
2718
2729
  });
2719
2730
  } else {
@@ -2785,21 +2796,27 @@
2785
2796
  return this._selectedMicrophone;
2786
2797
  }
2787
2798
  muteMicrophone(microphoneState) {
2788
- if (this._publishState == exports.PublishState.PUBLISHED) {
2789
- if (this._stream !== null) {
2790
- if (microphoneState) {
2791
- this._logger.success(this, "WebRTCStreamer :: Unmuting microphone");
2792
- } else {
2793
- this._logger.success(this, "WebRTCStreamer :: Muting microphone");
2794
- }
2795
- for (let i = 0; i < this._stream.getAudioTracks().length; i++) this._stream.getAudioTracks()[i].enabled = microphoneState;
2796
- this._isMicrophoneMuted = !microphoneState;
2799
+ this._isMicrophoneMuted = microphoneState;
2800
+ if (this._stream != null) {
2801
+ if (microphoneState) {
2802
+ this._logger.success(this, "WebRTCStreamer1 :: Unmuting microphone");
2797
2803
  } else {
2798
- this._logger.warning(this, "WebRTCStreamer :: Stream object not present!");
2804
+ this._logger.success(this, "WebRTCStreamer1 :: Muting microphone");
2799
2805
  }
2806
+ if (this._stream.getAudioTracks() != null) {
2807
+ for (let i = 0; i < this._stream.getAudioTracks().length; i++) this._stream.getAudioTracks()[i].enabled = microphoneState;
2808
+ }
2809
+ this._isMicrophoneMuted = !microphoneState;
2800
2810
  } else {
2801
- this._logger.warning(this, "WebRTCStreamer :: Not ready to change microphone");
2811
+ this._logger.warning(this, "WebRTCStreamer :: Stream object not present!");
2802
2812
  }
2813
+ this._main.dispatchEvent("microphoneStateChange", {
2814
+ ref: this._main,
2815
+ isMuted: this._isMicrophoneMuted
2816
+ });
2817
+ }
2818
+ isMicrophoneMuted() {
2819
+ return this._isMicrophoneMuted;
2803
2820
  }
2804
2821
  onDescriptionError(error) {
2805
2822
  this._logger.info(this, "WebRTCStreamer :: onDescriptionError: " + JSON.stringify(error));
@@ -2831,10 +2848,13 @@
2831
2848
  });
2832
2849
  }
2833
2850
  getCameraList() {
2834
- return this._cameraList.getArray();
2851
+ return this._cameraList != null ? this._cameraList.getArray() : [];
2835
2852
  }
2836
2853
  getMicrophoneList() {
2837
- return this._microphoneList.getArray();
2854
+ return this._microphoneList != null ? this._microphoneList.getArray() : [];
2855
+ }
2856
+ getPublishState() {
2857
+ return this._publishState;
2838
2858
  }
2839
2859
  getPlayer() {
2840
2860
  return this._selectedPlayer;
@@ -3149,8 +3169,8 @@
3149
3169
  constructor(streamConfig, autoInitialize = false) {
3150
3170
  super();
3151
3171
  this.DEV_MODE = true;
3152
- this.STREAMER_VERSION = "0.9.0-beta.0";
3153
- this.COMPILE_DATE = "11/28/2024, 9:22:53 AM";
3172
+ this.STREAMER_VERSION = "0.9.0-beta.2";
3173
+ this.COMPILE_DATE = "11/29/2024, 6:55:45 PM";
3154
3174
  this.STREAMER_BRANCH = "Experimental";
3155
3175
  this.STREAMER_PROTOCOL_VERSION = 1;
3156
3176
  this._initialized = false;
@@ -3270,11 +3290,11 @@
3270
3290
  }
3271
3291
  getCameraList() {
3272
3292
  var _a, _b;
3273
- return (_b = (_a = this._playbackController) === null || _a === void 0 ? void 0 : _a.getCameraList()) !== null && _b !== void 0 ? _b : null;
3293
+ return (_b = (_a = this._playbackController) === null || _a === void 0 ? void 0 : _a.getCameraList()) !== null && _b !== void 0 ? _b : [];
3274
3294
  }
3275
3295
  getMicrophoneList() {
3276
3296
  var _a, _b;
3277
- return (_b = (_a = this._playbackController) === null || _a === void 0 ? void 0 : _a.getMicrophoneList()) !== null && _b !== void 0 ? _b : null;
3297
+ return (_b = (_a = this._playbackController) === null || _a === void 0 ? void 0 : _a.getMicrophoneList()) !== null && _b !== void 0 ? _b : [];
3278
3298
  }
3279
3299
  setCamera(cameraID) {
3280
3300
  var _a;
@@ -3294,6 +3314,14 @@
3294
3314
  var _a;
3295
3315
  (_a = this._playbackController) === null || _a === void 0 ? void 0 : _a.muteMicrophone(microphoneState);
3296
3316
  }
3317
+ isMicrophoneMuted() {
3318
+ var _a, _b;
3319
+ return (_b = (_a = this._playbackController) === null || _a === void 0 ? void 0 : _a.isMicrophoneMuted()) !== null && _b !== void 0 ? _b : false;
3320
+ }
3321
+ getPublishState() {
3322
+ var _a, _b;
3323
+ return (_b = (_a = this._playbackController) === null || _a === void 0 ? void 0 : _a.getPublishState()) !== null && _b !== void 0 ? _b : exports.PublishState.NOT_INITIALIZED;
3324
+ }
3297
3325
  publish(streamKey) {
3298
3326
  var _a;
3299
3327
  (_a = this._playbackController) === null || _a === void 0 ? void 0 : _a.publish(streamKey);
@@ -3428,6 +3456,7 @@
3428
3456
  destroy() {
3429
3457
  var _a, _b, _c;
3430
3458
  this._logger.warning(this, "Destroying library instance, bye, bye!");
3459
+ if (this.DEV_MODE && 'StormStreamerArray' in window) window.StormStreamerArray[this._streamerID] = null;
3431
3460
  this._initialized = false;
3432
3461
  this._isRemoved = true;
3433
3462
  (_a = this._networkController) === null || _a === void 0 ? void 0 : _a.getConnection().destroy();