@stormstreaming/stormstreamer 0.9.1-beta.3 → 0.9.2-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.
- package/dist/amd/index.js +457 -90
- package/dist/cjs/index.js +8 -8
- package/dist/esm/index.js +12 -12
- package/dist/iife/index.js +8 -8
- package/dist/types/StormStreamer.d.ts +20 -8
- package/dist/types/config/DebugData.d.ts +4 -0
- package/dist/types/graph/BitrateGraph.d.ts +11 -0
- package/dist/types/graph/FPSGraph.d.ts +11 -0
- package/dist/types/graph/GraphDrawer.d.ts +27 -0
- package/dist/types/graph/IGraph.d.ts +4 -0
- package/dist/types/logger/Logger.d.ts +1 -0
- package/dist/types/playback/{PlaybackController.d.ts → StreamerController.d.ts} +5 -1
- package/dist/types/playback/model/StreamStatusInfo.d.ts +15 -6
- package/dist/types/playback/player/AbstractPlayer.d.ts +2 -2
- package/dist/types/stage/StageController.d.ts +1 -0
- package/dist/types/statistics/StatsController.d.ts +25 -0
- package/dist/types/types/DebugConfig.d.ts +3 -0
- package/dist/umd/index.js +8 -8
- package/package.json +1 -1
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.
|
|
8
|
-
* Version:
|
|
7
|
+
* Version: 0.9.2-beta.0
|
|
8
|
+
* Version: 3/6/2025, 12:46:46 PM
|
|
9
9
|
*
|
|
10
10
|
* LEGAL NOTICE:
|
|
11
11
|
* This software is subject to the terms and conditions defined in
|
|
@@ -372,10 +372,12 @@
|
|
|
372
372
|
this._containerLogEnabled = false;
|
|
373
373
|
this._enabledContainerTypes = [LogType.INFO, LogType.ERROR, LogType.SUCCESS, LogType.TRACE, LogType.WARNING];
|
|
374
374
|
this._containerLogMonoColor = false;
|
|
375
|
+
this._stageController = true;
|
|
376
|
+
this._streamerController = true;
|
|
375
377
|
this.parse(debugConfig);
|
|
376
378
|
}
|
|
377
379
|
parse(debugConfig) {
|
|
378
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
380
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
|
379
381
|
this._debugConfig = debugConfig;
|
|
380
382
|
if (this._debugConfig) {
|
|
381
383
|
this._consoleLogEnabled = (_c = (_b = (_a = this._debugConfig) === null || _a === void 0 ? void 0 : _a.console) === null || _b === void 0 ? void 0 : _b.enabled) !== null && _c !== void 0 ? _c : this._consoleLogEnabled;
|
|
@@ -385,6 +387,8 @@
|
|
|
385
387
|
this._containerLogMonoColor = (_q = (_p = (_o = this._debugConfig) === null || _o === void 0 ? void 0 : _o.container) === null || _p === void 0 ? void 0 : _p.monoColor) !== null && _q !== void 0 ? _q : this._containerLogMonoColor;
|
|
386
388
|
this._enabledContainerTypes = (_t = this.parseLogTypes((_s = (_r = this._debugConfig) === null || _r === void 0 ? void 0 : _r.container) === null || _s === void 0 ? void 0 : _s.logTypes)) !== null && _t !== void 0 ? _t : this._enabledContainerTypes;
|
|
387
389
|
this._containerID = (_w = (_v = (_u = this._debugConfig) === null || _u === void 0 ? void 0 : _u.container) === null || _v === void 0 ? void 0 : _v.containerID) !== null && _w !== void 0 ? _w : this._containerID;
|
|
390
|
+
this._streamerController = (_y = (_x = this._debugConfig) === null || _x === void 0 ? void 0 : _x.streamerController) !== null && _y !== void 0 ? _y : this._streamerController;
|
|
391
|
+
this._stageController = (_0 = (_z = this._debugConfig) === null || _z === void 0 ? void 0 : _z.stageController) !== null && _0 !== void 0 ? _0 : this._stageController;
|
|
388
392
|
}
|
|
389
393
|
}
|
|
390
394
|
parseLogTypes(logTypes) {
|
|
@@ -485,6 +489,12 @@
|
|
|
485
489
|
set containerLogMonoColor(newValue) {
|
|
486
490
|
this._containerLogMonoColor = newValue;
|
|
487
491
|
}
|
|
492
|
+
get stageControllerDebug() {
|
|
493
|
+
return this._stageController;
|
|
494
|
+
}
|
|
495
|
+
get streamerControllerDebug() {
|
|
496
|
+
return this._streamerController;
|
|
497
|
+
}
|
|
488
498
|
print(logger, force = false) {
|
|
489
499
|
if (DebugData.PRINT_ON_STARTUP || force) {
|
|
490
500
|
let consoleLogTypes = "";
|
|
@@ -876,6 +886,23 @@
|
|
|
876
886
|
}
|
|
877
887
|
}
|
|
878
888
|
}
|
|
889
|
+
decoratedLog(text, scheme) {
|
|
890
|
+
const EMOJI_MAP = ["0️⃣", "1️⃣", "2️⃣", "3️⃣", "4️⃣", "5️⃣", "6️⃣", "7️⃣", "8️⃣", "9️⃣", "🔟"];
|
|
891
|
+
const COLOR_SCHEMES = {
|
|
892
|
+
'dark-blue': '#4c9fee',
|
|
893
|
+
'dark-green': '#4bcb64',
|
|
894
|
+
'dark-orange': '#daa33a',
|
|
895
|
+
'dark-red': '#f86464',
|
|
896
|
+
'dark-pink': '#f864e8',
|
|
897
|
+
'dark-yellow': '#e1f864'
|
|
898
|
+
};
|
|
899
|
+
const id = this._stormStreamer.getStreamerID();
|
|
900
|
+
const keyCaps = id >= 0 && id < EMOJI_MAP.length ? EMOJI_MAP[id] : `[${id}]`;
|
|
901
|
+
const color = COLOR_SCHEMES[scheme];
|
|
902
|
+
if (!color) return;
|
|
903
|
+
const style = `background: black; color: ${color}; border: 1px solid ${color}; padding: 5px 5px 5px 0px`;
|
|
904
|
+
console.log(`%c 🎦️${keyCaps} ${text}`, style);
|
|
905
|
+
}
|
|
879
906
|
error(objectName, message) {
|
|
880
907
|
let output = this.logData(objectName, message);
|
|
881
908
|
if (this._debugConfig.consoleLogEnabled) {
|
|
@@ -955,18 +982,6 @@
|
|
|
955
982
|
Logger.SUCCESS_COLOR = "green";
|
|
956
983
|
Logger.TRACE_COLOR = "black";
|
|
957
984
|
|
|
958
|
-
class ClientUser {
|
|
959
|
-
constructor() {
|
|
960
|
-
this.bandwidthCapabilities = 0;
|
|
961
|
-
}
|
|
962
|
-
setBandwidthCapabilities(newCapabilities) {
|
|
963
|
-
this.bandwidthCapabilities = newCapabilities;
|
|
964
|
-
}
|
|
965
|
-
getBandwidthCapabilities() {
|
|
966
|
-
return this.bandwidthCapabilities;
|
|
967
|
-
}
|
|
968
|
-
}
|
|
969
|
-
|
|
970
985
|
class UserCapabilities {
|
|
971
986
|
static hasWebSocketsSupport() {
|
|
972
987
|
return window.WebSocket != null;
|
|
@@ -1761,6 +1776,7 @@
|
|
|
1761
1776
|
this._isResizing = false;
|
|
1762
1777
|
this._autoResizeEnabled = true;
|
|
1763
1778
|
this._parentOriginalOverflow = '';
|
|
1779
|
+
this._debug = false;
|
|
1764
1780
|
this.onFullScreenChange = () => {
|
|
1765
1781
|
if (document.fullscreenElement == null) {
|
|
1766
1782
|
this.isInFullScreenMode = false;
|
|
@@ -1782,9 +1798,10 @@
|
|
|
1782
1798
|
this.initialize();
|
|
1783
1799
|
}
|
|
1784
1800
|
initialize() {
|
|
1785
|
-
var _a, _b, _c, _d, _e, _f;
|
|
1801
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1786
1802
|
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;
|
|
1787
1803
|
this._scalingMode = (_f = (_e = this._main.getConfigManager()) === null || _e === void 0 ? void 0 : _e.getSettingsData().getVideoData().scalingMode) !== null && _f !== void 0 ? _f : ScalingType.FILL;
|
|
1804
|
+
this._debug = (_h = (_g = this._main.getConfigManager()) === null || _g === void 0 ? void 0 : _g.getSettingsData().getDebugData().stageControllerDebug) !== null && _h !== void 0 ? _h : this._debug;
|
|
1788
1805
|
this._videoContainer = document.createElement('div');
|
|
1789
1806
|
this._videoContainer.setAttribute("id", "stormStreamer_" + this._main.getStreamerID());
|
|
1790
1807
|
this._videoContainer.style.overflow = "hidden";
|
|
@@ -1830,10 +1847,12 @@
|
|
|
1830
1847
|
tempParentElement = container;
|
|
1831
1848
|
}
|
|
1832
1849
|
if (tempParentElement === this._parentElement) {
|
|
1850
|
+
if (this._debug) this._logger.decoratedLog("Attaching Failed (container is the same)", "dark-pink");
|
|
1833
1851
|
this._logger.warning(this, "attachToParent :: container is the same");
|
|
1834
1852
|
return false;
|
|
1835
1853
|
}
|
|
1836
1854
|
if (tempParentElement && this._videoContainer) {
|
|
1855
|
+
if (this._debug) this._logger.decoratedLog("Attach To Parent: " + container + " (success)", "dark-pink");
|
|
1837
1856
|
this._parentElement = tempParentElement;
|
|
1838
1857
|
this._parentElement.appendChild(this._videoContainer);
|
|
1839
1858
|
this._resizeObserver.observe(this._parentElement);
|
|
@@ -1847,13 +1866,13 @@
|
|
|
1847
1866
|
this.handleResize();
|
|
1848
1867
|
result = true;
|
|
1849
1868
|
} else {
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
this._logger.warning(this, "attachToParent :: container was not found");
|
|
1869
|
+
if (this._debug) this._logger.decoratedLog("Attach To Parent: " + container + " (failure - container not found)", "dark-pink");
|
|
1870
|
+
this._logger.warning(this, "attachToParent :: container \"" + container + "\"+ was not found");
|
|
1853
1871
|
}
|
|
1854
1872
|
return result;
|
|
1855
1873
|
}
|
|
1856
1874
|
detachFromParent() {
|
|
1875
|
+
if (this._debug) this._logger.decoratedLog("Detach From Parent", "dark-pink");
|
|
1857
1876
|
let result = false;
|
|
1858
1877
|
if (this._parentElement != null && this._videoContainer != null) {
|
|
1859
1878
|
this._logger.info(this, "Detaching from parent: " + this._videoContainer);
|
|
@@ -2490,7 +2509,6 @@
|
|
|
2490
2509
|
this._analyser.smoothingTimeConstant = 0.3;
|
|
2491
2510
|
this._microphone.connect(this._analyser);
|
|
2492
2511
|
this.startMonitoring();
|
|
2493
|
-
console.log('SoundMeter: Successfully attached to new audio stream');
|
|
2494
2512
|
} catch (error) {
|
|
2495
2513
|
console.error('SoundMeter: Error during attach:', error);
|
|
2496
2514
|
this.detach();
|
|
@@ -2524,7 +2542,6 @@
|
|
|
2524
2542
|
}
|
|
2525
2543
|
this._audioContext = null;
|
|
2526
2544
|
this.clear();
|
|
2527
|
-
console.log('SoundMeter: Successfully detached');
|
|
2528
2545
|
}
|
|
2529
2546
|
clear() {
|
|
2530
2547
|
this._instant = 0;
|
|
@@ -2708,11 +2725,14 @@
|
|
|
2708
2725
|
class StreamStatusInfo {
|
|
2709
2726
|
constructor() {
|
|
2710
2727
|
this._publishState = exports.PublishState.NOT_INITIALIZED;
|
|
2711
|
-
this.
|
|
2712
|
-
this.
|
|
2728
|
+
this._videoPublishBitrate = 0;
|
|
2729
|
+
this._audioPublishBitrate = 0;
|
|
2730
|
+
this._currentBitrate = 0;
|
|
2713
2731
|
this._audioFrameCount = 0;
|
|
2714
2732
|
this._videoFrameCount = 0;
|
|
2715
2733
|
this._frameRate = 0;
|
|
2734
|
+
this._videoWidth = 0;
|
|
2735
|
+
this._videoHeight = 0;
|
|
2716
2736
|
}
|
|
2717
2737
|
get publishState() {
|
|
2718
2738
|
return this._publishState;
|
|
@@ -2720,17 +2740,23 @@
|
|
|
2720
2740
|
set publishState(value) {
|
|
2721
2741
|
this._publishState = value === "published" ? exports.PublishState.PUBLISHED : exports.PublishState.CONNECTED;
|
|
2722
2742
|
}
|
|
2723
|
-
get
|
|
2724
|
-
return this.
|
|
2743
|
+
get videoPublishBitrate() {
|
|
2744
|
+
return this._videoPublishBitrate;
|
|
2745
|
+
}
|
|
2746
|
+
set videoPublishBitrate(value) {
|
|
2747
|
+
this._videoPublishBitrate = value;
|
|
2725
2748
|
}
|
|
2726
|
-
|
|
2727
|
-
this.
|
|
2749
|
+
get audioPublishBitrate() {
|
|
2750
|
+
return this._audioPublishBitrate;
|
|
2728
2751
|
}
|
|
2729
|
-
|
|
2730
|
-
|
|
2752
|
+
set audioPublishBitrate(value) {
|
|
2753
|
+
this._audioPublishBitrate = value;
|
|
2731
2754
|
}
|
|
2732
|
-
set
|
|
2733
|
-
this.
|
|
2755
|
+
set currentBitrate(value) {
|
|
2756
|
+
this._currentBitrate = value;
|
|
2757
|
+
}
|
|
2758
|
+
get currentBitrate() {
|
|
2759
|
+
return this._currentBitrate;
|
|
2734
2760
|
}
|
|
2735
2761
|
get audioFrameCount() {
|
|
2736
2762
|
return this._audioFrameCount;
|
|
@@ -2750,6 +2776,18 @@
|
|
|
2750
2776
|
set frameRate(value) {
|
|
2751
2777
|
this._frameRate = value;
|
|
2752
2778
|
}
|
|
2779
|
+
set videoWidth(value) {
|
|
2780
|
+
this._videoWidth = value;
|
|
2781
|
+
}
|
|
2782
|
+
get videoWidth() {
|
|
2783
|
+
return this._videoWidth;
|
|
2784
|
+
}
|
|
2785
|
+
set videoHeight(value) {
|
|
2786
|
+
this._videoHeight = value;
|
|
2787
|
+
}
|
|
2788
|
+
get videoHeight() {
|
|
2789
|
+
return this._videoHeight;
|
|
2790
|
+
}
|
|
2753
2791
|
}
|
|
2754
2792
|
|
|
2755
2793
|
class WowzaStatusConnection extends AbstractSocket {
|
|
@@ -2809,11 +2847,15 @@
|
|
|
2809
2847
|
case "STREAM_STATUS_RESPONSE":
|
|
2810
2848
|
const streamStatusInfo = new StreamStatusInfo();
|
|
2811
2849
|
streamStatusInfo.publishState = msgJSON.streamStatus;
|
|
2812
|
-
streamStatusInfo.
|
|
2813
|
-
streamStatusInfo.
|
|
2850
|
+
streamStatusInfo.videoPublishBitrate = msgJSON.publishVideoBitrate;
|
|
2851
|
+
streamStatusInfo.audioPublishBitrate = msgJSON.publishAudioBitrate;
|
|
2814
2852
|
streamStatusInfo.videoFrameCount = msgJSON.videoFrameCount;
|
|
2815
2853
|
streamStatusInfo.audioFrameCount = msgJSON.audioFrameCount;
|
|
2816
2854
|
streamStatusInfo.frameRate = msgJSON.frameRate;
|
|
2855
|
+
streamStatusInfo.videoWidth = msgJSON.videoWidth;
|
|
2856
|
+
streamStatusInfo.videoHeight = msgJSON.videoHeight;
|
|
2857
|
+
streamStatusInfo.currentBitrate = msgJSON.realBitrate;
|
|
2858
|
+
console.log(streamStatusInfo);
|
|
2817
2859
|
this._main.dispatchEvent("streamStatusUpdate", {
|
|
2818
2860
|
ref: this._main,
|
|
2819
2861
|
streamStatus: streamStatusInfo
|
|
@@ -2901,9 +2943,9 @@
|
|
|
2901
2943
|
}
|
|
2902
2944
|
}
|
|
2903
2945
|
|
|
2904
|
-
class
|
|
2946
|
+
class StreamerController {
|
|
2905
2947
|
constructor(main) {
|
|
2906
|
-
var _a;
|
|
2948
|
+
var _a, _b, _c;
|
|
2907
2949
|
this._isWindowActive = true;
|
|
2908
2950
|
this._peerConnectionConfig = {
|
|
2909
2951
|
'iceServers': []
|
|
@@ -2934,12 +2976,14 @@
|
|
|
2934
2976
|
this._restartTimerCount = 0;
|
|
2935
2977
|
this._restartTimerMaxCount = 5;
|
|
2936
2978
|
this._publishState = exports.PublishState.NOT_INITIALIZED;
|
|
2979
|
+
this._publishTime = 0;
|
|
2937
2980
|
this._inputDeviceState = exports.StreamerState.NOT_INITIALIZED;
|
|
2938
2981
|
this._cameraState = exports.DeviceState.NOT_INITIALIZED;
|
|
2939
2982
|
this._microphoneState = exports.DeviceState.NOT_INITIALIZED;
|
|
2940
2983
|
this._publishTimer = 0;
|
|
2941
2984
|
this._currentOrientation = ((_a = window.screen.orientation) === null || _a === void 0 ? void 0 : _a.type) || '';
|
|
2942
2985
|
this._statusTimer = null;
|
|
2986
|
+
this._debug = false;
|
|
2943
2987
|
this.onDeviceStateChange = event => {
|
|
2944
2988
|
var _a;
|
|
2945
2989
|
const usedStreamKey = (_a = this._main.getConfigManager()) === null || _a === void 0 ? void 0 : _a.getStreamData().streamKey;
|
|
@@ -2948,13 +2992,13 @@
|
|
|
2948
2992
|
}
|
|
2949
2993
|
};
|
|
2950
2994
|
this.handleOrientationChange = () => __awaiter(this, void 0, void 0, function* () {
|
|
2951
|
-
var
|
|
2995
|
+
var _d, _e;
|
|
2952
2996
|
yield new Promise(resolve => setTimeout(resolve, 500));
|
|
2953
|
-
const newOrientation = ((
|
|
2997
|
+
const newOrientation = ((_d = window.screen.orientation) === null || _d === void 0 ? void 0 : _d.type) || '';
|
|
2954
2998
|
if (this._currentOrientation !== newOrientation) {
|
|
2955
2999
|
this._logger.info(this, `Orientation changed from ${this._currentOrientation} to ${newOrientation}`);
|
|
2956
3000
|
this._currentOrientation = newOrientation;
|
|
2957
|
-
const streamKey = (
|
|
3001
|
+
const streamKey = (_e = this._main.getConfigManager()) === null || _e === void 0 ? void 0 : _e.getStreamData().streamKey;
|
|
2958
3002
|
this._publishState === exports.PublishState.PUBLISHED;
|
|
2959
3003
|
this.closeWebRTCConnection();
|
|
2960
3004
|
if (this._stream) {
|
|
@@ -3044,12 +3088,16 @@
|
|
|
3044
3088
|
if (this._statusTimer == null) {
|
|
3045
3089
|
if (this._statusConnection != null && usedStreamKey != null) {
|
|
3046
3090
|
this._statusTimer = setInterval(() => {
|
|
3047
|
-
|
|
3048
|
-
(_a = this._statusConnection) === null || _a === void 0 ? void 0 : _a.sendData('{"packetID":"STREAM_STATUS", "streamKey": "' + usedStreamKey + '"}');
|
|
3091
|
+
this.requestStatusData();
|
|
3049
3092
|
}, 1000);
|
|
3050
3093
|
}
|
|
3051
3094
|
}
|
|
3052
3095
|
};
|
|
3096
|
+
this.requestStatusData = () => {
|
|
3097
|
+
var _a;
|
|
3098
|
+
const usedStreamKey = this._main.getConfigManager().getStreamData().streamKey;
|
|
3099
|
+
(_a = this._statusConnection) === null || _a === void 0 ? void 0 : _a.sendData('{"packetID":"STREAM_STATUS", "streamKey": "' + usedStreamKey + '"}');
|
|
3100
|
+
};
|
|
3053
3101
|
this.onStatusServerDisconnect = () => {
|
|
3054
3102
|
if (this._statusTimer != null) clearInterval(this._statusTimer);
|
|
3055
3103
|
this._statusTimer = null;
|
|
@@ -3058,7 +3106,6 @@
|
|
|
3058
3106
|
const update = event.streamStatus;
|
|
3059
3107
|
if (this._publishState == exports.PublishState.PUBLISHED && update.publishState != exports.PublishState.PUBLISHED) this.setPublishState(exports.PublishState.UNPUBLISHED);
|
|
3060
3108
|
if (this._publishState == exports.PublishState.CONNECTED && update.publishState == exports.PublishState.PUBLISHED) this.setPublishState(exports.PublishState.PUBLISHED);
|
|
3061
|
-
this._logger.info(this, "Stream Status Update :: VideoBitrate " + update.videoBitrate + " | AudioBitrate : " + update.audioBitrate + " | Video Frames: " + update.videoFrameCount + " | Audio Frames: " + update.audioFrameCount + " | FPS: " + update.frameRate);
|
|
3062
3109
|
};
|
|
3063
3110
|
this.onDescriptionSuccess = description => {
|
|
3064
3111
|
var _a, _b, _c;
|
|
@@ -3106,6 +3153,7 @@
|
|
|
3106
3153
|
this._logger = main.getLogger();
|
|
3107
3154
|
this._mungeSDP = new MungeSDP();
|
|
3108
3155
|
this._soundMeter = new SoundMeter(this._main);
|
|
3156
|
+
this._debug = (_c = (_b = this._main.getConfigManager()) === null || _b === void 0 ? void 0 : _b.getSettingsData().getDebugData().streamerControllerDebug) !== null && _c !== void 0 ? _c : this._debug;
|
|
3109
3157
|
this.initialize();
|
|
3110
3158
|
}
|
|
3111
3159
|
initialize() {
|
|
@@ -3271,16 +3319,18 @@
|
|
|
3271
3319
|
}
|
|
3272
3320
|
}
|
|
3273
3321
|
publish(streamKey) {
|
|
3274
|
-
this.
|
|
3322
|
+
if (this._statusTimer != null) clearInterval(this._statusTimer);
|
|
3275
3323
|
if (this._main.getConfigManager().getStreamData().streamKey == streamKey && this._publishState == exports.PublishState.CONNECTED) {
|
|
3276
3324
|
this._logger.warning(this, "Already published!");
|
|
3277
3325
|
return false;
|
|
3278
3326
|
}
|
|
3327
|
+
if (this._main.getConfigManager().getStreamData().streamKey != null) this.unpublish();
|
|
3279
3328
|
this._main.getConfigManager().getStreamData().streamKey = streamKey;
|
|
3280
3329
|
if (!this.isStreamReady(true, true)) {
|
|
3281
3330
|
this._logger.warning(this, "Cannot publish - stream not ready (missing video or audio track)");
|
|
3282
3331
|
return false;
|
|
3283
3332
|
}
|
|
3333
|
+
if (this._debug) this._logger.decoratedLog("Publishing: " + streamKey, "dark-red");
|
|
3284
3334
|
this._logger.info(this, "Publish: " + streamKey);
|
|
3285
3335
|
this.closeWebRTCConnection();
|
|
3286
3336
|
this._main.dispatchEvent("publish", {
|
|
@@ -3291,10 +3341,13 @@
|
|
|
3291
3341
|
return true;
|
|
3292
3342
|
}
|
|
3293
3343
|
unpublish() {
|
|
3344
|
+
if (this._debug) this._logger.decoratedLog("Unpublish", "dark-red");
|
|
3294
3345
|
if (this._statusConnection != null) {
|
|
3295
3346
|
this._statusConnection.destroy();
|
|
3296
3347
|
this._statusConnection = null;
|
|
3297
|
-
|
|
3348
|
+
}
|
|
3349
|
+
if (this._statusTimer != null) {
|
|
3350
|
+
clearInterval(this._statusTimer);
|
|
3298
3351
|
this._statusTimer = null;
|
|
3299
3352
|
}
|
|
3300
3353
|
clearTimeout(this._publishTimer);
|
|
@@ -3857,13 +3910,18 @@
|
|
|
3857
3910
|
}
|
|
3858
3911
|
setPublishState(newState) {
|
|
3859
3912
|
if (this._publishState == newState) return;
|
|
3913
|
+
if (this._debug) this._logger.decoratedLog("Publish State: " + newState, "dark-blue");
|
|
3860
3914
|
this._logger.info(this, "Publish State: " + newState);
|
|
3915
|
+
if (newState == exports.PublishState.PUBLISHED) this._publishTime = new Date().getTime();
|
|
3861
3916
|
this._publishState = newState;
|
|
3862
3917
|
this._main.dispatchEvent("publishStateChange", {
|
|
3863
3918
|
ref: this._main,
|
|
3864
3919
|
state: this._publishState
|
|
3865
3920
|
});
|
|
3866
3921
|
}
|
|
3922
|
+
getPublishTime() {
|
|
3923
|
+
return this._publishState == exports.PublishState.PUBLISHED ? this._publishTime : 0;
|
|
3924
|
+
}
|
|
3867
3925
|
setInputDeviceState(newState) {
|
|
3868
3926
|
if (this._inputDeviceState == newState) return;
|
|
3869
3927
|
this._inputDeviceState = newState;
|
|
@@ -3990,6 +4048,7 @@
|
|
|
3990
4048
|
clearInterval(this._statusTimer);
|
|
3991
4049
|
this._statusTimer = null;
|
|
3992
4050
|
}
|
|
4051
|
+
this._main.getConfigManager().getStreamData().streamKey = null;
|
|
3993
4052
|
this.closeWebRTCConnection();
|
|
3994
4053
|
this.stopCameraStream();
|
|
3995
4054
|
this.setPublishState(exports.PublishState.STOPPED);
|
|
@@ -4199,7 +4258,7 @@
|
|
|
4199
4258
|
};
|
|
4200
4259
|
this.onMessage = event => {
|
|
4201
4260
|
var _a;
|
|
4202
|
-
(_a = this._main.
|
|
4261
|
+
(_a = this._main.getStreamerController()) === null || _a === void 0 ? void 0 : _a.onSocketMessage(event.data);
|
|
4203
4262
|
};
|
|
4204
4263
|
this._main = main;
|
|
4205
4264
|
this._logger = main.getLogger();
|
|
@@ -4236,17 +4295,297 @@
|
|
|
4236
4295
|
}
|
|
4237
4296
|
}
|
|
4238
4297
|
|
|
4298
|
+
class StatsController {
|
|
4299
|
+
constructor(main) {
|
|
4300
|
+
this._publishVideoWidth = 0;
|
|
4301
|
+
this._publishVideoHeight = 0;
|
|
4302
|
+
this._publishVideoBitrate = 0;
|
|
4303
|
+
this._publishAudioBitrate = 0;
|
|
4304
|
+
this._currentBitrate = 0;
|
|
4305
|
+
this._currentFPS = 0;
|
|
4306
|
+
this._deliveredVideoFrames = 0;
|
|
4307
|
+
this._deliveredAudioFrames = 0;
|
|
4308
|
+
this.onStreamStatsUpdate = event => {
|
|
4309
|
+
this._publishVideoWidth = event.streamStatus.videoWidth;
|
|
4310
|
+
this._publishVideoHeight = event.streamStatus.videoHeight;
|
|
4311
|
+
this._currentBitrate = event.streamStatus.currentBitrate;
|
|
4312
|
+
this._publishVideoBitrate = event.streamStatus.videoPublishBitrate;
|
|
4313
|
+
this._publishAudioBitrate = event.streamStatus.audioPublishBitrate;
|
|
4314
|
+
this._currentFPS = event.streamStatus.frameRate;
|
|
4315
|
+
this._deliveredVideoFrames = event.streamStatus.videoFrameCount;
|
|
4316
|
+
this._deliveredAudioFrames = event.streamStatus.audioFrameCount;
|
|
4317
|
+
};
|
|
4318
|
+
this._main = main;
|
|
4319
|
+
this._logger = main.getLogger();
|
|
4320
|
+
this._logger.info(this, "Creating new StatsController");
|
|
4321
|
+
this.initialize();
|
|
4322
|
+
}
|
|
4323
|
+
initialize() {
|
|
4324
|
+
this._main.addEventListener("streamStatusUpdate", this.onStreamStatsUpdate, false);
|
|
4325
|
+
}
|
|
4326
|
+
get deliveredVideoFrames() {
|
|
4327
|
+
return this._deliveredVideoFrames;
|
|
4328
|
+
}
|
|
4329
|
+
get deliveredAudioFrames() {
|
|
4330
|
+
return this._deliveredAudioFrames;
|
|
4331
|
+
}
|
|
4332
|
+
get currentFPS() {
|
|
4333
|
+
return this._currentFPS;
|
|
4334
|
+
}
|
|
4335
|
+
get publishVideoWidth() {
|
|
4336
|
+
return this._publishVideoWidth;
|
|
4337
|
+
}
|
|
4338
|
+
get publishVideoHeight() {
|
|
4339
|
+
return this._publishVideoHeight;
|
|
4340
|
+
}
|
|
4341
|
+
get currentBitrate() {
|
|
4342
|
+
return this._currentBitrate;
|
|
4343
|
+
}
|
|
4344
|
+
get publishVideoBitrate() {
|
|
4345
|
+
return this._publishVideoBitrate;
|
|
4346
|
+
}
|
|
4347
|
+
get publishAudioBitrate() {
|
|
4348
|
+
return this._publishAudioBitrate;
|
|
4349
|
+
}
|
|
4350
|
+
}
|
|
4351
|
+
|
|
4352
|
+
class GraphDrawer {
|
|
4353
|
+
constructor(containerIdOrElement, valueRanges, colors, lineWidth = 1) {
|
|
4354
|
+
this._currentX = 0;
|
|
4355
|
+
this._isFullyDrawn = false;
|
|
4356
|
+
this._lastTimestamp = null;
|
|
4357
|
+
this._isTimemarkLine = false;
|
|
4358
|
+
this._borderWidth = 1;
|
|
4359
|
+
if (colors.length !== valueRanges.length + 1) {
|
|
4360
|
+
throw new Error(`Colors array must have exactly ${valueRanges.length + 1} elements (one more than valueRanges)`);
|
|
4361
|
+
}
|
|
4362
|
+
for (let i = 1; i < valueRanges.length; i++) {
|
|
4363
|
+
if (valueRanges[i] <= valueRanges[i - 1]) {
|
|
4364
|
+
throw new Error('ValueRanges must be in ascending order');
|
|
4365
|
+
}
|
|
4366
|
+
}
|
|
4367
|
+
const hexColorRegex = /^#[0-9A-Fa-f]{6}$/;
|
|
4368
|
+
if (!colors.every(color => hexColorRegex.test(color))) {
|
|
4369
|
+
throw new Error('All colors must be in valid hex format (e.g., #FF0000)');
|
|
4370
|
+
}
|
|
4371
|
+
let container;
|
|
4372
|
+
if (typeof containerIdOrElement === 'string') {
|
|
4373
|
+
const foundElement = document.getElementById(containerIdOrElement);
|
|
4374
|
+
if (!foundElement) {
|
|
4375
|
+
throw new Error(`Container element with id ${containerIdOrElement} not found`);
|
|
4376
|
+
}
|
|
4377
|
+
container = foundElement;
|
|
4378
|
+
} else {
|
|
4379
|
+
container = containerIdOrElement;
|
|
4380
|
+
}
|
|
4381
|
+
const containerRect = container.getBoundingClientRect();
|
|
4382
|
+
this._width = Math.floor(containerRect.width);
|
|
4383
|
+
this._height = Math.floor(containerRect.height);
|
|
4384
|
+
this._effectiveWidth = this._width - this._borderWidth * 2;
|
|
4385
|
+
this._effectiveHeight = this._height - this._borderWidth * 2;
|
|
4386
|
+
this._canvas = document.createElement('canvas');
|
|
4387
|
+
container.appendChild(this._canvas);
|
|
4388
|
+
const context = this._canvas.getContext('2d', {
|
|
4389
|
+
willReadFrequently: true
|
|
4390
|
+
});
|
|
4391
|
+
if (!context) {
|
|
4392
|
+
throw new Error('Failed to get canvas context');
|
|
4393
|
+
}
|
|
4394
|
+
this._ctx = context;
|
|
4395
|
+
this._valueRanges = [0, ...valueRanges];
|
|
4396
|
+
this._colors = colors;
|
|
4397
|
+
this._lineWidth = lineWidth;
|
|
4398
|
+
this._canvas.width = this._width;
|
|
4399
|
+
this._canvas.height = this._height;
|
|
4400
|
+
this._canvas.style.width = `${this._width}px`;
|
|
4401
|
+
this._canvas.style.height = `${this._height}px`;
|
|
4402
|
+
this.clear();
|
|
4403
|
+
}
|
|
4404
|
+
drawBorder() {
|
|
4405
|
+
this._ctx.strokeStyle = '#000000';
|
|
4406
|
+
this._ctx.lineWidth = this._borderWidth;
|
|
4407
|
+
this._ctx.strokeRect(this._borderWidth / 2, this._borderWidth / 2, this._width - this._borderWidth, this._height - this._borderWidth);
|
|
4408
|
+
}
|
|
4409
|
+
clear() {
|
|
4410
|
+
this._ctx.clearRect(0, 0, this._width, this._height);
|
|
4411
|
+
this._ctx.fillStyle = this._colors[0];
|
|
4412
|
+
this._ctx.fillRect(this._borderWidth, this._borderWidth, this._effectiveWidth, this._effectiveHeight);
|
|
4413
|
+
this.drawBorder();
|
|
4414
|
+
this._isFullyDrawn = false;
|
|
4415
|
+
this._currentX = this._borderWidth;
|
|
4416
|
+
this._lastTimestamp = null;
|
|
4417
|
+
this._isTimemarkLine = false;
|
|
4418
|
+
}
|
|
4419
|
+
getColorIndices(value) {
|
|
4420
|
+
for (let i = 0; i < this._valueRanges.length - 1; i++) {
|
|
4421
|
+
if (value >= this._valueRanges[i] && value <= this._valueRanges[i + 1]) {
|
|
4422
|
+
return {
|
|
4423
|
+
lowerIndex: i,
|
|
4424
|
+
upperIndex: i + 1
|
|
4425
|
+
};
|
|
4426
|
+
}
|
|
4427
|
+
}
|
|
4428
|
+
return {
|
|
4429
|
+
lowerIndex: this._valueRanges.length - 2,
|
|
4430
|
+
upperIndex: this._valueRanges.length - 1
|
|
4431
|
+
};
|
|
4432
|
+
}
|
|
4433
|
+
calculateHeightRatio(value, lowerBound, upperBound) {
|
|
4434
|
+
return (value - lowerBound) / (upperBound - lowerBound);
|
|
4435
|
+
}
|
|
4436
|
+
shiftCanvasLeft(shiftAmount) {
|
|
4437
|
+
const imageData = this._ctx.getImageData(this._borderWidth + shiftAmount, this._borderWidth, this._effectiveWidth - shiftAmount, this._effectiveHeight);
|
|
4438
|
+
this._ctx.fillStyle = this._colors[0];
|
|
4439
|
+
this._ctx.fillRect(this._borderWidth, this._borderWidth, this._effectiveWidth, this._effectiveHeight);
|
|
4440
|
+
this._ctx.putImageData(imageData, this._borderWidth, this._borderWidth);
|
|
4441
|
+
this.drawBorder();
|
|
4442
|
+
}
|
|
4443
|
+
applyOverlayEffect(baseColor, overlayOpacity = 0.5) {
|
|
4444
|
+
const r = parseInt(baseColor.slice(1, 3), 16);
|
|
4445
|
+
const g = parseInt(baseColor.slice(3, 5), 16);
|
|
4446
|
+
const b = parseInt(baseColor.slice(5, 7), 16);
|
|
4447
|
+
const overlayChannel = base => {
|
|
4448
|
+
const normalized = base / 255;
|
|
4449
|
+
let result;
|
|
4450
|
+
if (normalized <= 0.5) {
|
|
4451
|
+
result = 2 * normalized * 1;
|
|
4452
|
+
} else {
|
|
4453
|
+
result = 1 - 2 * (1 - normalized) * (1 - 1);
|
|
4454
|
+
}
|
|
4455
|
+
return Math.round(result * 255 * overlayOpacity + base * (1 - overlayOpacity));
|
|
4456
|
+
};
|
|
4457
|
+
const newR = overlayChannel(r);
|
|
4458
|
+
const newG = overlayChannel(g);
|
|
4459
|
+
const newB = overlayChannel(b);
|
|
4460
|
+
const toHex = n => {
|
|
4461
|
+
const hex = n.toString(16);
|
|
4462
|
+
return hex.length === 1 ? '0' + hex : hex;
|
|
4463
|
+
};
|
|
4464
|
+
return `#${toHex(newR)}${toHex(newG)}${toHex(newB)}`;
|
|
4465
|
+
}
|
|
4466
|
+
addEntry(value) {
|
|
4467
|
+
value = Math.round(value * 100) / 100;
|
|
4468
|
+
const currentTime = Date.now();
|
|
4469
|
+
if (this._lastTimestamp === null) {
|
|
4470
|
+
this._lastTimestamp = currentTime;
|
|
4471
|
+
this._isTimemarkLine = false;
|
|
4472
|
+
} else {
|
|
4473
|
+
const timeDiff = currentTime - this._lastTimestamp;
|
|
4474
|
+
if (timeDiff >= 1000) {
|
|
4475
|
+
this._isTimemarkLine = true;
|
|
4476
|
+
this._lastTimestamp = currentTime;
|
|
4477
|
+
} else {
|
|
4478
|
+
this._isTimemarkLine = false;
|
|
4479
|
+
}
|
|
4480
|
+
}
|
|
4481
|
+
const drawWidth = this._isTimemarkLine ? 1 : this._lineWidth;
|
|
4482
|
+
if (!this._isFullyDrawn && this._currentX >= this._width - this._borderWidth) {
|
|
4483
|
+
this._isFullyDrawn = true;
|
|
4484
|
+
}
|
|
4485
|
+
if (this._isFullyDrawn) {
|
|
4486
|
+
this.shiftCanvasLeft(drawWidth);
|
|
4487
|
+
this.drawLine(this._width - this._borderWidth - drawWidth, value, drawWidth);
|
|
4488
|
+
} else {
|
|
4489
|
+
this.drawLine(this._currentX, value, drawWidth);
|
|
4490
|
+
this._currentX += drawWidth;
|
|
4491
|
+
}
|
|
4492
|
+
}
|
|
4493
|
+
drawLine(x, value, width) {
|
|
4494
|
+
const {
|
|
4495
|
+
lowerIndex,
|
|
4496
|
+
upperIndex
|
|
4497
|
+
} = this.getColorIndices(value);
|
|
4498
|
+
const ratio = this.calculateHeightRatio(value, this._valueRanges[lowerIndex], this._valueRanges[upperIndex]);
|
|
4499
|
+
let lowerColor = this._colors[lowerIndex];
|
|
4500
|
+
let upperColor = this._colors[upperIndex];
|
|
4501
|
+
if (this._isTimemarkLine) {
|
|
4502
|
+
lowerColor = this.applyOverlayEffect(lowerColor, 0.3);
|
|
4503
|
+
upperColor = this.applyOverlayEffect(upperColor, 0.3);
|
|
4504
|
+
}
|
|
4505
|
+
const upperHeight = Math.round(this._effectiveHeight * ratio);
|
|
4506
|
+
const lowerHeight = this._effectiveHeight - upperHeight;
|
|
4507
|
+
this._ctx.fillStyle = lowerColor;
|
|
4508
|
+
this._ctx.fillRect(x, this._height - this._borderWidth - lowerHeight, width, lowerHeight);
|
|
4509
|
+
this._ctx.fillStyle = upperColor;
|
|
4510
|
+
this._ctx.fillRect(x, this._borderWidth, width, upperHeight);
|
|
4511
|
+
}
|
|
4512
|
+
clearGraph() {
|
|
4513
|
+
this._currentX = this._borderWidth;
|
|
4514
|
+
this._isFullyDrawn = false;
|
|
4515
|
+
this._lastTimestamp = null;
|
|
4516
|
+
this._isTimemarkLine = false;
|
|
4517
|
+
this.clear();
|
|
4518
|
+
}
|
|
4519
|
+
destroy() {
|
|
4520
|
+
if (this._canvas.parentNode) {
|
|
4521
|
+
this._canvas.parentNode.removeChild(this._canvas);
|
|
4522
|
+
}
|
|
4523
|
+
}
|
|
4524
|
+
}
|
|
4525
|
+
|
|
4526
|
+
class BitrateGraph {
|
|
4527
|
+
constructor(main, container) {
|
|
4528
|
+
this.onStreamStatsUpdate = event => {
|
|
4529
|
+
var _a;
|
|
4530
|
+
(_a = this._graph) === null || _a === void 0 ? void 0 : _a.addEntry(event.streamStatus.currentBitrate);
|
|
4531
|
+
};
|
|
4532
|
+
this._main = main;
|
|
4533
|
+
this._object = container;
|
|
4534
|
+
this._main.addGraph(this);
|
|
4535
|
+
}
|
|
4536
|
+
start() {
|
|
4537
|
+
if (this._graph != null) stop();
|
|
4538
|
+
const valueRanges = [1000000, 2000000, 3000000, 5000000, 6000000, 7000000];
|
|
4539
|
+
const colors = ['#000000', '#0a3980', '#2793dd', '#3bc39c', '#c3df3e', '#f89539', '#f83f3f'];
|
|
4540
|
+
this._graph = new GraphDrawer(this._object, valueRanges, colors);
|
|
4541
|
+
this._main.addEventListener("streamStatusUpdate", this.onStreamStatsUpdate);
|
|
4542
|
+
return this;
|
|
4543
|
+
}
|
|
4544
|
+
stop() {
|
|
4545
|
+
this._main.removeEventListener("streamStatusUpdate", this.onStreamStatsUpdate);
|
|
4546
|
+
if (this._graph != null) this._graph.destroy();
|
|
4547
|
+
this._graph = null;
|
|
4548
|
+
return this;
|
|
4549
|
+
}
|
|
4550
|
+
}
|
|
4551
|
+
|
|
4552
|
+
class FPSGraph {
|
|
4553
|
+
constructor(main, container) {
|
|
4554
|
+
this.onStreamStatsUpdate = event => {
|
|
4555
|
+
var _a;
|
|
4556
|
+
(_a = this._graph) === null || _a === void 0 ? void 0 : _a.addEntry(event.streamStatus.frameRate);
|
|
4557
|
+
};
|
|
4558
|
+
this._main = main;
|
|
4559
|
+
this._object = container;
|
|
4560
|
+
this._main.addGraph(this);
|
|
4561
|
+
}
|
|
4562
|
+
start() {
|
|
4563
|
+
if (this._graph != null) stop();
|
|
4564
|
+
const valueRanges = [25, 26, 27, 28, 29, 30];
|
|
4565
|
+
const colors = ['#000000', '#0a3980', '#2793dd', '#3bc39c', '#c3df3e', '#f89539', '#f83f3f'];
|
|
4566
|
+
this._graph = new GraphDrawer(this._object, valueRanges, colors);
|
|
4567
|
+
this._main.addEventListener("streamStatusUpdate", this.onStreamStatsUpdate);
|
|
4568
|
+
return this;
|
|
4569
|
+
}
|
|
4570
|
+
stop() {
|
|
4571
|
+
this._main.removeEventListener("streamStatusUpdate", this.onStreamStatsUpdate);
|
|
4572
|
+
if (this._graph != null) this._graph.destroy();
|
|
4573
|
+
this._graph = null;
|
|
4574
|
+
return this;
|
|
4575
|
+
}
|
|
4576
|
+
}
|
|
4577
|
+
|
|
4239
4578
|
class StormStreamer extends EventDispatcher {
|
|
4240
4579
|
constructor(streamConfig, autoInitialize = false) {
|
|
4241
4580
|
super();
|
|
4242
4581
|
this.DEV_MODE = true;
|
|
4243
|
-
this.STREAMER_VERSION = "0.9.
|
|
4244
|
-
this.COMPILE_DATE = "
|
|
4582
|
+
this.STREAMER_VERSION = "0.9.2-beta.0";
|
|
4583
|
+
this.COMPILE_DATE = "3/6/2025, 12:46:45 PM";
|
|
4245
4584
|
this.STREAMER_BRANCH = "Experimental";
|
|
4246
4585
|
this.STREAMER_PROTOCOL_VERSION = 1;
|
|
4247
4586
|
this._initialized = false;
|
|
4248
4587
|
if (typeof window === 'undefined' || !window.document || !window.document.createElement) {
|
|
4249
|
-
console.error(`
|
|
4588
|
+
console.error(`StormStreamer Creation Error - No "window" element in the provided context!`);
|
|
4250
4589
|
return;
|
|
4251
4590
|
}
|
|
4252
4591
|
if (this.DEV_MODE && !('StormStreamerArray' in window)) {
|
|
@@ -4260,12 +4599,13 @@
|
|
|
4260
4599
|
}
|
|
4261
4600
|
initialize() {
|
|
4262
4601
|
if (this._isRemoved) return;
|
|
4263
|
-
if (this._configManager == null) throw Error("Stream Config was not provided for this
|
|
4602
|
+
if (this._configManager == null) throw Error("Stream Config was not provided for this streamer! A properly configured object must be provided through the constructor or via the setConfig method before using the initialize() method.");
|
|
4264
4603
|
this._storageManager = new StorageManager(this);
|
|
4265
4604
|
this._stageController = new StageController(this);
|
|
4266
4605
|
this._networkController = new NetworkController(this);
|
|
4267
|
-
this.
|
|
4268
|
-
this.
|
|
4606
|
+
this._streamerController = new StreamerController(this);
|
|
4607
|
+
this._statsController = new StatsController(this);
|
|
4608
|
+
this._graphs = [];
|
|
4269
4609
|
this._initialized = true;
|
|
4270
4610
|
this.dispatchEvent("streamerReady", {
|
|
4271
4611
|
ref: this
|
|
@@ -4300,22 +4640,6 @@
|
|
|
4300
4640
|
var _a, _b;
|
|
4301
4641
|
return (_b = (_a = this._networkController) === null || _a === void 0 ? void 0 : _a.getConnection().isConnectionActive()) !== null && _b !== void 0 ? _b : false;
|
|
4302
4642
|
}
|
|
4303
|
-
attachToContainer(container) {
|
|
4304
|
-
var _a, _b;
|
|
4305
|
-
let result = false;
|
|
4306
|
-
if (this._initialized) return (_b = (_a = this._stageController) === null || _a === void 0 ? void 0 : _a.attachToParent(container)) !== null && _b !== void 0 ? _b : false;
|
|
4307
|
-
return result;
|
|
4308
|
-
}
|
|
4309
|
-
detachFromContainer() {
|
|
4310
|
-
var _a, _b;
|
|
4311
|
-
let result = false;
|
|
4312
|
-
if (this._initialized) return (_b = (_a = this._stageController) === null || _a === void 0 ? void 0 : _a.detachFromParent()) !== null && _b !== void 0 ? _b : false;
|
|
4313
|
-
return result;
|
|
4314
|
-
}
|
|
4315
|
-
getContainer() {
|
|
4316
|
-
var _a, _b;
|
|
4317
|
-
return (_b = (_a = this._stageController) === null || _a === void 0 ? void 0 : _a.getParentElement()) !== null && _b !== void 0 ? _b : null;
|
|
4318
|
-
}
|
|
4319
4643
|
mute() {
|
|
4320
4644
|
if (this._stageController != null) {
|
|
4321
4645
|
if (this._stageController.getScreenElement() != null) {
|
|
@@ -4360,69 +4684,89 @@
|
|
|
4360
4684
|
}
|
|
4361
4685
|
getCameraList() {
|
|
4362
4686
|
var _a, _b;
|
|
4363
|
-
return (_b = (_a = this.
|
|
4687
|
+
return (_b = (_a = this._streamerController) === null || _a === void 0 ? void 0 : _a.getCameraList()) !== null && _b !== void 0 ? _b : [];
|
|
4364
4688
|
}
|
|
4365
4689
|
getMicrophoneList() {
|
|
4366
4690
|
var _a, _b;
|
|
4367
|
-
return (_b = (_a = this.
|
|
4691
|
+
return (_b = (_a = this._streamerController) === null || _a === void 0 ? void 0 : _a.getMicrophoneList()) !== null && _b !== void 0 ? _b : [];
|
|
4368
4692
|
}
|
|
4369
4693
|
setCamera(cameraID) {
|
|
4370
4694
|
var _a;
|
|
4371
|
-
(_a = this.
|
|
4695
|
+
(_a = this._streamerController) === null || _a === void 0 ? void 0 : _a.selectCamera(cameraID);
|
|
4372
4696
|
}
|
|
4373
4697
|
setMicrophone(microphoneID) {
|
|
4374
4698
|
var _a;
|
|
4375
|
-
(_a = this.
|
|
4699
|
+
(_a = this._streamerController) === null || _a === void 0 ? void 0 : _a.selectMicrophone(microphoneID);
|
|
4376
4700
|
}
|
|
4377
4701
|
getCurrentCamera() {
|
|
4378
|
-
return this.
|
|
4702
|
+
return this._streamerController.getCurrentCamera();
|
|
4379
4703
|
}
|
|
4380
4704
|
getCurrentMicrophone() {
|
|
4381
|
-
return this.
|
|
4705
|
+
return this._streamerController.getCurrentMicrophone();
|
|
4382
4706
|
}
|
|
4383
4707
|
muteMicrophone(microphoneState) {
|
|
4384
4708
|
var _a;
|
|
4385
|
-
(_a = this.
|
|
4709
|
+
(_a = this._streamerController) === null || _a === void 0 ? void 0 : _a.muteMicrophone(microphoneState);
|
|
4386
4710
|
}
|
|
4387
4711
|
isMicrophoneMuted() {
|
|
4388
4712
|
var _a, _b;
|
|
4389
|
-
return (_b = (_a = this.
|
|
4713
|
+
return (_b = (_a = this._streamerController) === null || _a === void 0 ? void 0 : _a.isMicrophoneMuted()) !== null && _b !== void 0 ? _b : false;
|
|
4390
4714
|
}
|
|
4391
4715
|
getPublishState() {
|
|
4392
4716
|
var _a, _b;
|
|
4393
|
-
return (_b = (_a = this.
|
|
4717
|
+
return (_b = (_a = this._streamerController) === null || _a === void 0 ? void 0 : _a.getPublishState()) !== null && _b !== void 0 ? _b : exports.PublishState.NOT_INITIALIZED;
|
|
4718
|
+
}
|
|
4719
|
+
getPublishTime() {
|
|
4720
|
+
var _a, _b;
|
|
4721
|
+
return (_b = (_a = this._streamerController) === null || _a === void 0 ? void 0 : _a.getPublishTime()) !== null && _b !== void 0 ? _b : 0;
|
|
4394
4722
|
}
|
|
4395
4723
|
publish(streamKey) {
|
|
4396
4724
|
var _a, _b;
|
|
4397
|
-
return (_b = (_a = this.
|
|
4725
|
+
return (_b = (_a = this._streamerController) === null || _a === void 0 ? void 0 : _a.publish(streamKey)) !== null && _b !== void 0 ? _b : false;
|
|
4398
4726
|
}
|
|
4399
|
-
|
|
4727
|
+
getInputDeviceState() {
|
|
4400
4728
|
var _a, _b;
|
|
4401
|
-
return (_b = (_a = this.
|
|
4729
|
+
return (_b = (_a = this._streamerController) === null || _a === void 0 ? void 0 : _a.getInputDeviceState()) !== null && _b !== void 0 ? _b : exports.StreamerState.NOT_INITIALIZED;
|
|
4402
4730
|
}
|
|
4403
4731
|
getCamerState() {
|
|
4404
4732
|
var _a, _b;
|
|
4405
|
-
return (_b = (_a = this.
|
|
4733
|
+
return (_b = (_a = this._streamerController) === null || _a === void 0 ? void 0 : _a.getCamerState()) !== null && _b !== void 0 ? _b : exports.DeviceState.NOT_INITIALIZED;
|
|
4406
4734
|
}
|
|
4407
4735
|
getMicrophoneState() {
|
|
4408
4736
|
var _a, _b;
|
|
4409
|
-
return (_b = (_a = this.
|
|
4737
|
+
return (_b = (_a = this._streamerController) === null || _a === void 0 ? void 0 : _a.getMicrophoneState()) !== null && _b !== void 0 ? _b : exports.DeviceState.NOT_INITIALIZED;
|
|
4410
4738
|
}
|
|
4411
4739
|
clearSavedDevices() {
|
|
4412
4740
|
var _a;
|
|
4413
|
-
return (_a = this.
|
|
4741
|
+
return (_a = this._streamerController) === null || _a === void 0 ? void 0 : _a.clearSavedDevices();
|
|
4414
4742
|
}
|
|
4415
4743
|
messSavedDevices() {
|
|
4416
4744
|
var _a;
|
|
4417
|
-
return (_a = this.
|
|
4745
|
+
return (_a = this._streamerController) === null || _a === void 0 ? void 0 : _a.messSavedDevices();
|
|
4418
4746
|
}
|
|
4419
4747
|
isStreamReady() {
|
|
4420
4748
|
var _a, _b;
|
|
4421
|
-
return (_b = (_a = this.
|
|
4749
|
+
return (_b = (_a = this._streamerController) === null || _a === void 0 ? void 0 : _a.isStreamReady()) !== null && _b !== void 0 ? _b : false;
|
|
4422
4750
|
}
|
|
4423
4751
|
unpublish() {
|
|
4424
4752
|
var _a;
|
|
4425
|
-
(_a = this.
|
|
4753
|
+
(_a = this._streamerController) === null || _a === void 0 ? void 0 : _a.unpublish();
|
|
4754
|
+
}
|
|
4755
|
+
attachToContainer(container) {
|
|
4756
|
+
var _a, _b;
|
|
4757
|
+
let result = false;
|
|
4758
|
+
if (this._initialized) return (_b = (_a = this._stageController) === null || _a === void 0 ? void 0 : _a.attachToParent(container)) !== null && _b !== void 0 ? _b : false;
|
|
4759
|
+
return result;
|
|
4760
|
+
}
|
|
4761
|
+
detachFromContainer() {
|
|
4762
|
+
var _a, _b;
|
|
4763
|
+
let result = false;
|
|
4764
|
+
if (this._initialized) return (_b = (_a = this._stageController) === null || _a === void 0 ? void 0 : _a.detachFromParent()) !== null && _b !== void 0 ? _b : false;
|
|
4765
|
+
return result;
|
|
4766
|
+
}
|
|
4767
|
+
getContainer() {
|
|
4768
|
+
var _a, _b;
|
|
4769
|
+
return (_b = (_a = this._stageController) === null || _a === void 0 ? void 0 : _a.getParentElement()) !== null && _b !== void 0 ? _b : null;
|
|
4426
4770
|
}
|
|
4427
4771
|
setSize(width, height) {
|
|
4428
4772
|
if (this._initialized) this._stageController.setSize(width, height);else {
|
|
@@ -4500,6 +4844,22 @@
|
|
|
4500
4844
|
}
|
|
4501
4845
|
});
|
|
4502
4846
|
}
|
|
4847
|
+
createFPSGraph(container) {
|
|
4848
|
+
return new FPSGraph(this, container);
|
|
4849
|
+
}
|
|
4850
|
+
createBitrateGraph(container) {
|
|
4851
|
+
return new BitrateGraph(this, container);
|
|
4852
|
+
}
|
|
4853
|
+
addGraph(newGraph) {
|
|
4854
|
+
if (this._graphs != null) this._graphs.push(newGraph);
|
|
4855
|
+
}
|
|
4856
|
+
stopAllGraphs() {
|
|
4857
|
+
if (this._graphs != null && this._graphs.length > 0) {
|
|
4858
|
+
for (let i = 0; i < this._graphs.length; i++) {
|
|
4859
|
+
this._graphs[i].stop();
|
|
4860
|
+
}
|
|
4861
|
+
}
|
|
4862
|
+
}
|
|
4503
4863
|
enterFullScreen() {
|
|
4504
4864
|
if (this._initialized && this._stageController) this._stageController.enterFullScreen();
|
|
4505
4865
|
}
|
|
@@ -4510,6 +4870,13 @@
|
|
|
4510
4870
|
if (this._initialized && this._stageController) return this._stageController.isFullScreenMode();
|
|
4511
4871
|
return false;
|
|
4512
4872
|
}
|
|
4873
|
+
getStreamKey() {
|
|
4874
|
+
var _a, _b, _c;
|
|
4875
|
+
return (_c = (_b = (_a = this.getConfigManager()) === null || _a === void 0 ? void 0 : _a.getStreamData()) === null || _b === void 0 ? void 0 : _b.streamKey) !== null && _c !== void 0 ? _c : null;
|
|
4876
|
+
}
|
|
4877
|
+
getStatsController() {
|
|
4878
|
+
return this._statsController;
|
|
4879
|
+
}
|
|
4513
4880
|
getStreamerID() {
|
|
4514
4881
|
return this._streamerID;
|
|
4515
4882
|
}
|
|
@@ -4522,8 +4889,8 @@
|
|
|
4522
4889
|
getNetworkController() {
|
|
4523
4890
|
return this._networkController;
|
|
4524
4891
|
}
|
|
4525
|
-
|
|
4526
|
-
return this.
|
|
4892
|
+
getStreamerController() {
|
|
4893
|
+
return this._streamerController;
|
|
4527
4894
|
}
|
|
4528
4895
|
getStageController() {
|
|
4529
4896
|
return this._stageController;
|
|
@@ -4550,21 +4917,21 @@
|
|
|
4550
4917
|
start() {
|
|
4551
4918
|
var _a;
|
|
4552
4919
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4553
|
-
return (_a = this.
|
|
4920
|
+
return (_a = this._streamerController) === null || _a === void 0 ? void 0 : _a.start();
|
|
4554
4921
|
});
|
|
4555
4922
|
}
|
|
4556
4923
|
stop() {
|
|
4557
4924
|
var _a;
|
|
4558
|
-
return (_a = this.
|
|
4925
|
+
return (_a = this._streamerController) === null || _a === void 0 ? void 0 : _a.stop();
|
|
4559
4926
|
}
|
|
4560
4927
|
destroy() {
|
|
4561
4928
|
var _a, _b, _c, _d;
|
|
4562
|
-
this._logger.warning(this, "Destroying
|
|
4929
|
+
this._logger.warning(this, "Destroying streamer instance, bye, bye!");
|
|
4563
4930
|
if (this.DEV_MODE && 'StormStreamerArray' in window) window.StormStreamerArray[this._streamerID] = null;
|
|
4564
4931
|
this._initialized = false;
|
|
4565
4932
|
this._isRemoved = true;
|
|
4566
4933
|
(_b = (_a = this._networkController) === null || _a === void 0 ? void 0 : _a.getConnection()) === null || _b === void 0 ? void 0 : _b.destroy();
|
|
4567
|
-
(_c = this.
|
|
4934
|
+
(_c = this._streamerController) === null || _c === void 0 ? void 0 : _c.destroy();
|
|
4568
4935
|
(_d = this._stageController) === null || _d === void 0 ? void 0 : _d.destroy();
|
|
4569
4936
|
this.removeAllEventListeners();
|
|
4570
4937
|
}
|