@stormstreaming/stormstreamer 0.9.0-beta.6 ā 0.9.0-beta.7
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 +72 -43
- package/dist/cjs/index.js +3 -3
- package/dist/esm/index.js +3 -3
- package/dist/iife/index.js +3 -3
- package/dist/types/config/SettingsData.d.ts +1 -1
- package/dist/types/events/StormStreamerEvent.d.ts +7 -1
- package/dist/types/playback/PlaybackController.d.ts +4 -0
- package/dist/umd/index.js +3 -3
- 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.0-beta.
|
|
8
|
-
* Version:
|
|
7
|
+
* Version: 0.9.0-beta.7
|
|
8
|
+
* Version: 1/2/2025, 1:53:46 AM
|
|
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.
|
|
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.
|
|
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.
|
|
629
|
+
return !this._preselectDevices;
|
|
630
630
|
}
|
|
631
631
|
getIfStartOnDOMReadyEnabled() {
|
|
632
632
|
return this.startOnDOMReady;
|
|
@@ -2615,41 +2615,75 @@
|
|
|
2615
2615
|
},
|
|
2616
2616
|
audio: true
|
|
2617
2617
|
};
|
|
2618
|
+
this._restartTimerCount = 0;
|
|
2619
|
+
this._restartTimerMaxCount = 5;
|
|
2618
2620
|
this._publishState = exports.PublishState.NOT_INITIALIZED;
|
|
2619
2621
|
this._inputDeviceState = exports.DevicesState.NOT_INITIALIZED;
|
|
2620
2622
|
this.onServerDisconnect = () => {};
|
|
2623
|
+
this.onStreamKeyTaken = () => {
|
|
2624
|
+
if (this._restartTimer != null) {
|
|
2625
|
+
clearInterval(this._restartTimer);
|
|
2626
|
+
this._restartTimerCount = 0;
|
|
2627
|
+
}
|
|
2628
|
+
this._logger.info(this, "WebRTCStreamer :: Starting StreamKeyTaken Interval");
|
|
2629
|
+
this._restartTimer = setInterval(() => {
|
|
2630
|
+
var _a, _b;
|
|
2631
|
+
if (this._restartTimer != null) {
|
|
2632
|
+
if (this._restartTimerCount < this._restartTimerMaxCount) {
|
|
2633
|
+
this._logger.info(this, "WebRTCStreamer :: StreamKeyTaken Interval: " + this._restartTimerCount + "/" + this._restartTimerMaxCount);
|
|
2634
|
+
this._restartTimerCount++;
|
|
2635
|
+
} else {
|
|
2636
|
+
clearInterval(this._restartTimer);
|
|
2637
|
+
this._restartTimer = null;
|
|
2638
|
+
this._restartTimerCount = 0;
|
|
2639
|
+
const streamData = (_a = this._main.getConfigManager()) === null || _a === void 0 ? void 0 : _a.getStreamData();
|
|
2640
|
+
const streamKey = streamData === null || streamData === void 0 ? void 0 : streamData.streamKey;
|
|
2641
|
+
if (streamKey != null) {
|
|
2642
|
+
const prevStreamKey = streamKey;
|
|
2643
|
+
this.publish(prevStreamKey);
|
|
2644
|
+
}
|
|
2645
|
+
}
|
|
2646
|
+
const usedStreamKey = (_b = this._main.getConfigManager().getStreamData().streamKey) !== null && _b !== void 0 ? _b : "unknown";
|
|
2647
|
+
this._main.dispatchEvent("streamKeyInUseInterval", {
|
|
2648
|
+
ref: this._main,
|
|
2649
|
+
streamKey: usedStreamKey,
|
|
2650
|
+
count: this._restartTimerCount,
|
|
2651
|
+
maxCount: this._restartTimerMaxCount
|
|
2652
|
+
});
|
|
2653
|
+
}
|
|
2654
|
+
}, 1000);
|
|
2655
|
+
};
|
|
2621
2656
|
this.onServerConnect = () => {
|
|
2622
2657
|
if (this._peerConnection) {
|
|
2623
2658
|
this.closeWebRTCConnection();
|
|
2624
2659
|
}
|
|
2625
2660
|
this._peerConnection = new RTCPeerConnection(this._peerConnectionConfig);
|
|
2661
|
+
if (this._stream) {
|
|
2662
|
+
let localTracks = this._stream.getTracks();
|
|
2663
|
+
for (let localTrack in localTracks) {
|
|
2664
|
+
this._peerConnection.addTrack(localTracks[localTrack], this._stream);
|
|
2665
|
+
}
|
|
2666
|
+
}
|
|
2626
2667
|
this._peerConnection.onicecandidate = event => {
|
|
2627
2668
|
this.onIceCandidate(event);
|
|
2628
2669
|
};
|
|
2629
2670
|
this._peerConnection.onconnectionstatechange = event => {
|
|
2630
2671
|
this.onConnectionStateChange(event);
|
|
2631
2672
|
};
|
|
2632
|
-
this._peerConnection.onnegotiationneeded = event => {
|
|
2673
|
+
this._peerConnection.onnegotiationneeded = event => __awaiter(this, void 0, void 0, function* () {
|
|
2633
2674
|
if (this._peerConnection) {
|
|
2634
|
-
|
|
2635
|
-
this.
|
|
2636
|
-
|
|
2675
|
+
try {
|
|
2676
|
+
const description = yield this._peerConnection.createOffer();
|
|
2677
|
+
yield this.onDescriptionSuccess(description);
|
|
2678
|
+
} catch (error) {
|
|
2637
2679
|
this.onDescriptionError(error);
|
|
2638
|
-
|
|
2639
|
-
|
|
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);
|
|
2680
|
+
console.error('Error creating offer:', error);
|
|
2681
|
+
}
|
|
2647
2682
|
}
|
|
2648
|
-
}
|
|
2683
|
+
});
|
|
2649
2684
|
};
|
|
2650
2685
|
this.onDescriptionSuccess = description => {
|
|
2651
2686
|
var _a, _b, _c;
|
|
2652
|
-
console.log('%cāµ š„ onDescriptionSuccess ', 'background: green; color: white;');
|
|
2653
2687
|
const streamInfo = {
|
|
2654
2688
|
applicationName: (_b = (_a = this._main.getNetworkController()) === null || _a === void 0 ? void 0 : _a.getConnection().getCurrentServer()) === null || _b === void 0 ? void 0 : _b.getApplication(),
|
|
2655
2689
|
streamName: (_c = this._main.getConfigManager()) === null || _c === void 0 ? void 0 : _c.getStreamData().streamKey,
|
|
@@ -2700,6 +2734,7 @@
|
|
|
2700
2734
|
var _a, _b;
|
|
2701
2735
|
this._main.addEventListener("serverConnect", this.onServerConnect, false);
|
|
2702
2736
|
this._main.addEventListener("serverDisconnect", this.onServerDisconnect, false);
|
|
2737
|
+
this._main.addEventListener("streamKeyInUse", this.onStreamKeyTaken, false);
|
|
2703
2738
|
document.addEventListener("visibilitychange", this.visibilityChange);
|
|
2704
2739
|
window.addEventListener("blur", this.onWindowBlur);
|
|
2705
2740
|
window.addEventListener("focus", this.onWindowFocus);
|
|
@@ -2808,6 +2843,7 @@
|
|
|
2808
2843
|
this._logger.warning(this, "Cannot publish - stream not ready (missing video or audio track)");
|
|
2809
2844
|
return false;
|
|
2810
2845
|
}
|
|
2846
|
+
this._logger.info(this, "Publish: " + streamKey);
|
|
2811
2847
|
this.closeWebRTCConnection();
|
|
2812
2848
|
this._main.getConfigManager().getStreamData().streamKey = streamKey;
|
|
2813
2849
|
this._main.dispatchEvent("publish", {
|
|
@@ -2855,7 +2891,6 @@
|
|
|
2855
2891
|
console.error("Error checking device availability:", error);
|
|
2856
2892
|
}
|
|
2857
2893
|
if (isFirefox) {
|
|
2858
|
-
console.log("Firefox detected, using direct getUserMedia check...");
|
|
2859
2894
|
if (results.camera.available) {
|
|
2860
2895
|
try {
|
|
2861
2896
|
const stream = yield navigator.mediaDevices.getUserMedia({
|
|
@@ -2864,7 +2899,7 @@
|
|
|
2864
2899
|
results.camera.allowed = true;
|
|
2865
2900
|
stream.getTracks().forEach(track => track.stop());
|
|
2866
2901
|
} catch (e) {
|
|
2867
|
-
|
|
2902
|
+
this._logger.error(this, "Camera permission check failed: " + JSON.stringify(e));
|
|
2868
2903
|
results.camera.allowed = false;
|
|
2869
2904
|
}
|
|
2870
2905
|
}
|
|
@@ -2876,7 +2911,7 @@
|
|
|
2876
2911
|
results.microphone.allowed = true;
|
|
2877
2912
|
stream.getTracks().forEach(track => track.stop());
|
|
2878
2913
|
} catch (e) {
|
|
2879
|
-
|
|
2914
|
+
this._logger.error(this, "Microphone permission check failed: " + JSON.stringify(e));
|
|
2880
2915
|
results.microphone.allowed = false;
|
|
2881
2916
|
}
|
|
2882
2917
|
}
|
|
@@ -2903,22 +2938,23 @@
|
|
|
2903
2938
|
}
|
|
2904
2939
|
stream.getTracks().forEach(track => track.stop());
|
|
2905
2940
|
} catch (error) {
|
|
2906
|
-
|
|
2941
|
+
this._logger.error(this, "Additional permission check failed " + JSON.stringify(error));
|
|
2907
2942
|
}
|
|
2908
2943
|
}
|
|
2909
2944
|
} catch (error) {
|
|
2910
|
-
|
|
2945
|
+
this._logger.error(this, "Error checking permissions " + JSON.stringify(error));
|
|
2911
2946
|
}
|
|
2912
2947
|
}
|
|
2913
2948
|
return results;
|
|
2914
2949
|
});
|
|
2915
2950
|
}
|
|
2916
2951
|
onSocketMessage(data) {
|
|
2952
|
+
var _a;
|
|
2917
2953
|
let msgJSON = JSON.parse(data);
|
|
2918
2954
|
let msgStatus = Number(msgJSON["status"]);
|
|
2919
2955
|
switch (msgStatus) {
|
|
2920
2956
|
case 200:
|
|
2921
|
-
|
|
2957
|
+
this._logger.info(this, "SDP Exchange Successful");
|
|
2922
2958
|
let sdpData = msgJSON['sdp'];
|
|
2923
2959
|
if (sdpData !== undefined) {
|
|
2924
2960
|
this._peerConnection.setRemoteDescription(new RTCSessionDescription(sdpData), () => {}, () => {});
|
|
@@ -2931,17 +2967,18 @@
|
|
|
2931
2967
|
}
|
|
2932
2968
|
break;
|
|
2933
2969
|
case 503:
|
|
2934
|
-
|
|
2970
|
+
this._logger.error(this, "StreamKey already use");
|
|
2971
|
+
const usedStreamKey = (_a = this._main.getConfigManager().getStreamData().streamKey) !== null && _a !== void 0 ? _a : "unknown";
|
|
2935
2972
|
this._main.dispatchEvent("streamKeyInUse", {
|
|
2936
2973
|
ref: this._main,
|
|
2937
|
-
streamKey:
|
|
2974
|
+
streamKey: usedStreamKey
|
|
2938
2975
|
});
|
|
2939
2976
|
this.setPublishState(exports.PublishState.ERROR);
|
|
2940
2977
|
break;
|
|
2941
2978
|
}
|
|
2942
2979
|
}
|
|
2943
2980
|
onConnectionStateChange(event) {
|
|
2944
|
-
|
|
2981
|
+
this._logger.info(this, "Connection State Change: " + JSON.stringify(event));
|
|
2945
2982
|
if (event !== null) {
|
|
2946
2983
|
switch (event.currentTarget.connectionState) {
|
|
2947
2984
|
case "connecting":
|
|
@@ -3051,7 +3088,6 @@
|
|
|
3051
3088
|
for (let i = 0; i < this._cameraList.getSize(); i++) {
|
|
3052
3089
|
if (this._cameraList.get(i).getID() == cameraID) {
|
|
3053
3090
|
this._selectedCamera = this._cameraList.get(i);
|
|
3054
|
-
console.log("kamera znaleziona i zapisana " + this._cameraList.get(i).getLabel() + " " + this._cameraList.get(i).getID());
|
|
3055
3091
|
(_b = this._main.getStorageManager()) === null || _b === void 0 ? void 0 : _b.saveField("cameraID", this._selectedCamera.getID());
|
|
3056
3092
|
break;
|
|
3057
3093
|
}
|
|
@@ -3078,7 +3114,7 @@
|
|
|
3078
3114
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3079
3115
|
this._selectedMicrophone = null;
|
|
3080
3116
|
this.setInputDeviceState(exports.DevicesState.UPDATING);
|
|
3081
|
-
|
|
3117
|
+
this._logger.info(this, "Selecting microphone: " + micID);
|
|
3082
3118
|
const streamKey = (_a = this._main.getConfigManager()) === null || _a === void 0 ? void 0 : _a.getStreamData().streamKey;
|
|
3083
3119
|
const wasPublished = this._publishState === exports.PublishState.PUBLISHED;
|
|
3084
3120
|
for (let i = 0; i < this._microphoneList.getSize(); i++) {
|
|
@@ -3130,7 +3166,6 @@
|
|
|
3130
3166
|
startCamera() {
|
|
3131
3167
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3132
3168
|
if (this._stream) {
|
|
3133
|
-
console.log("Stopping existing stream before starting new one");
|
|
3134
3169
|
this._stream.getTracks().forEach(track => {
|
|
3135
3170
|
track.stop();
|
|
3136
3171
|
});
|
|
@@ -3357,7 +3392,7 @@
|
|
|
3357
3392
|
return this._selectedMicrophone;
|
|
3358
3393
|
}
|
|
3359
3394
|
setPublishState(newState) {
|
|
3360
|
-
|
|
3395
|
+
this._logger.info(this, "Publish State: " + newState);
|
|
3361
3396
|
this._publishState = newState;
|
|
3362
3397
|
this._main.dispatchEvent("publishStateChange", {
|
|
3363
3398
|
ref: this._main,
|
|
@@ -3365,7 +3400,6 @@
|
|
|
3365
3400
|
});
|
|
3366
3401
|
}
|
|
3367
3402
|
setInputDeviceState(newState) {
|
|
3368
|
-
console.log('%cāµ š„ setInputDeviceState: ' + newState, 'background: green; color: white;');
|
|
3369
3403
|
this._inputDeviceState = newState;
|
|
3370
3404
|
this._main.dispatchEvent("deviceStateChange", {
|
|
3371
3405
|
ref: this._main,
|
|
@@ -3403,7 +3437,6 @@
|
|
|
3403
3437
|
}
|
|
3404
3438
|
forceStopAllStreams() {
|
|
3405
3439
|
var _a, _b;
|
|
3406
|
-
console.log("Force stopping all streams...");
|
|
3407
3440
|
if (this._peerConnection) {
|
|
3408
3441
|
try {
|
|
3409
3442
|
const senders = this._peerConnection.getSenders();
|
|
@@ -3447,13 +3480,10 @@
|
|
|
3447
3480
|
if (this._stream) {
|
|
3448
3481
|
try {
|
|
3449
3482
|
const tracks = this._stream.getTracks();
|
|
3450
|
-
console.log(`Stopping ${tracks.length} tracks from main stream`);
|
|
3451
3483
|
tracks.forEach(track => {
|
|
3452
3484
|
try {
|
|
3453
|
-
console.log(`Stopping ${track.kind} track, enabled: ${track.enabled}, state: ${track.readyState}`);
|
|
3454
3485
|
track.enabled = false;
|
|
3455
3486
|
track.stop();
|
|
3456
|
-
console.log(`Track after stop - state: ${track.readyState}`);
|
|
3457
3487
|
} catch (e) {
|
|
3458
3488
|
console.error(`Error stopping ${track.kind} track:`, e);
|
|
3459
3489
|
}
|
|
@@ -3463,10 +3493,8 @@
|
|
|
3463
3493
|
console.error('Error stopping main stream:', e);
|
|
3464
3494
|
}
|
|
3465
3495
|
}
|
|
3466
|
-
console.log("All streams should be stopped now");
|
|
3467
3496
|
}
|
|
3468
3497
|
destroy() {
|
|
3469
|
-
console.log("Starting destroy process...");
|
|
3470
3498
|
this.forceStopAllStreams();
|
|
3471
3499
|
if (this._soundMeter) {
|
|
3472
3500
|
this._soundMeter.detach();
|
|
@@ -3487,7 +3515,7 @@
|
|
|
3487
3515
|
console.error('Error removing event listeners:', e);
|
|
3488
3516
|
}
|
|
3489
3517
|
this._publishState = exports.PublishState.NOT_INITIALIZED;
|
|
3490
|
-
|
|
3518
|
+
if (this._restartTimer != null) clearInterval(this._restartTimer);
|
|
3491
3519
|
}
|
|
3492
3520
|
}
|
|
3493
3521
|
|
|
@@ -3789,8 +3817,8 @@
|
|
|
3789
3817
|
constructor(streamConfig, autoInitialize = false) {
|
|
3790
3818
|
super();
|
|
3791
3819
|
this.DEV_MODE = true;
|
|
3792
|
-
this.STREAMER_VERSION = "0.9.0-beta.
|
|
3793
|
-
this.COMPILE_DATE = "
|
|
3820
|
+
this.STREAMER_VERSION = "0.9.0-beta.7";
|
|
3821
|
+
this.COMPILE_DATE = "1/2/2025, 1:53:45 AM";
|
|
3794
3822
|
this.STREAMER_BRANCH = "Experimental";
|
|
3795
3823
|
this.STREAMER_PROTOCOL_VERSION = 1;
|
|
3796
3824
|
this._initialized = false;
|
|
@@ -3944,6 +3972,7 @@
|
|
|
3944
3972
|
}
|
|
3945
3973
|
publish(streamKey) {
|
|
3946
3974
|
var _a, _b;
|
|
3975
|
+
console.log("gonzo daje publish");
|
|
3947
3976
|
return (_b = (_a = this._playbackController) === null || _a === void 0 ? void 0 : _a.publish(streamKey)) !== null && _b !== void 0 ? _b : false;
|
|
3948
3977
|
}
|
|
3949
3978
|
getDeviceState() {
|