@stormstreaming/stormstreamer 0.9.2-beta.2 → 0.9.3-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/README.md +130 -3
- package/dist/amd/index.js +2206 -105
- package/dist/cjs/index.js +3 -3
- package/dist/esm/index.js +3 -3
- package/dist/iife/index.js +4 -4
- package/dist/types/StormStreamer.d.ts +394 -3
- package/dist/types/config/AudioData.d.ts +46 -0
- package/dist/types/config/ConfigManager.d.ts +47 -0
- package/dist/types/config/DebugData.d.ts +108 -0
- package/dist/types/config/IConfig.d.ts +3 -0
- package/dist/types/config/SettingsData.d.ts +114 -0
- package/dist/types/config/StorageData.d.ts +46 -0
- package/dist/types/config/StreamData.d.ts +75 -0
- package/dist/types/config/VideoData.d.ts +115 -0
- package/dist/types/config/enum/LogType.d.ts +3 -0
- package/dist/types/config/enum/ProtocolType.d.ts +3 -0
- package/dist/types/config/enum/ScalingType.d.ts +3 -0
- package/dist/types/config/enum/SecurityType.d.ts +3 -0
- package/dist/types/config/enum/SizeCalculationType.d.ts +3 -0
- package/dist/types/events/EventDispatcher.d.ts +34 -0
- package/dist/types/graph/MicrophoneGraph.d.ts +11 -0
- package/dist/types/logger/Logger.d.ts +103 -0
- package/dist/types/model/AbstractSourceItem.d.ts +23 -0
- package/dist/types/model/GatewayServerItem.d.ts +53 -0
- package/dist/types/model/IServerItem.d.ts +3 -0
- package/dist/types/model/ISourceItem.d.ts +3 -0
- package/dist/types/model/IStreamItem.d.ts +3 -0
- package/dist/types/model/RTMPSourceItem.d.ts +50 -0
- package/dist/types/model/RTSPSourceItem.d.ts +50 -0
- package/dist/types/model/StormMetaDataItem.d.ts +3 -0
- package/dist/types/model/StormServerItem.d.ts +53 -0
- package/dist/types/model/StormSourceItem.d.ts +27 -0
- package/dist/types/model/StreamInfo.d.ts +46 -0
- package/dist/types/network/AbstractSocket.d.ts +94 -0
- package/dist/types/network/NetworkController.d.ts +33 -0
- package/dist/types/network/WowzaConnection.d.ts +63 -0
- package/dist/types/network/WowzaStatusConnection.d.ts +54 -0
- package/dist/types/playback/CooldownMonitor.d.ts +17 -0
- package/dist/types/playback/StreamerController.d.ts +267 -1
- package/dist/types/playback/enum/ConnectionState.d.ts +3 -0
- package/dist/types/playback/player/AbstractPlayer.d.ts +23 -0
- package/dist/types/playback/task/IPlaybackTask.d.ts +3 -0
- package/dist/types/stage/ScreenElement.d.ts +54 -0
- package/dist/types/stage/StageController.d.ts +86 -0
- package/dist/types/statistics/StatsController.d.ts +8 -0
- package/dist/types/storage/StorageManager.d.ts +37 -0
- package/dist/types/utilities/DomUtilities.d.ts +7 -0
- package/dist/types/utilities/NumberUtilities.d.ts +7 -0
- package/dist/types/utilities/UserCapabilities.d.ts +44 -0
- package/dist/umd/index.js +4 -4
- package/package.json +1 -1
|
@@ -1,26 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base for all classes that use WebSocksts
|
|
3
|
+
*/
|
|
1
4
|
import { ConnectionState } from "../playback/enum/ConnectionState";
|
|
2
5
|
import { Logger } from "../logger/Logger";
|
|
6
|
+
/**
|
|
7
|
+
* Abstract socket connection
|
|
8
|
+
*/
|
|
3
9
|
export declare class AbstractSocket {
|
|
10
|
+
/**
|
|
11
|
+
* Connection timeout
|
|
12
|
+
* @protected
|
|
13
|
+
*/
|
|
4
14
|
protected readonly CONNECTION_TIMEOUT: number;
|
|
15
|
+
/**
|
|
16
|
+
* Logger for this class
|
|
17
|
+
* @private
|
|
18
|
+
*/
|
|
5
19
|
protected _logger: Logger;
|
|
20
|
+
/**
|
|
21
|
+
* WebSocket object
|
|
22
|
+
* @protected
|
|
23
|
+
*/
|
|
6
24
|
protected socket: WebSocket;
|
|
25
|
+
/**
|
|
26
|
+
* Current WebSocket URL (with protocol and port)
|
|
27
|
+
* @protected
|
|
28
|
+
*/
|
|
7
29
|
protected socketURL: string;
|
|
30
|
+
/**
|
|
31
|
+
* Whenever it is binary data or not
|
|
32
|
+
* @protected
|
|
33
|
+
*/
|
|
8
34
|
protected isBinary: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Current state of the connection
|
|
37
|
+
* @private
|
|
38
|
+
*/
|
|
9
39
|
protected _connectionState: ConnectionState;
|
|
40
|
+
/**
|
|
41
|
+
* Number of messages that arrived
|
|
42
|
+
* @private
|
|
43
|
+
*/
|
|
10
44
|
protected _messageCount: number;
|
|
45
|
+
/**
|
|
46
|
+
* Connection timeout for the player
|
|
47
|
+
* @protected
|
|
48
|
+
*/
|
|
11
49
|
protected _connectionTimeout: any;
|
|
50
|
+
/**
|
|
51
|
+
* Was disconnected by user?
|
|
52
|
+
* @protected
|
|
53
|
+
*/
|
|
12
54
|
protected _disconnectedByUser: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Whenever we're connected to a server or not
|
|
57
|
+
* @private
|
|
58
|
+
*/
|
|
13
59
|
protected _isConnected: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Counts connections
|
|
62
|
+
* @protected
|
|
63
|
+
*/
|
|
14
64
|
protected _sequenceNumber: number;
|
|
65
|
+
/**
|
|
66
|
+
* Creates and starts new socket connection
|
|
67
|
+
*
|
|
68
|
+
* @param socketURL
|
|
69
|
+
* @private
|
|
70
|
+
*/
|
|
15
71
|
startConnection(): void;
|
|
72
|
+
/**
|
|
73
|
+
* Method is called once connection with the server is established
|
|
74
|
+
* @param event
|
|
75
|
+
*/
|
|
16
76
|
protected onSocketOpen(event: Event): void;
|
|
77
|
+
/**
|
|
78
|
+
* Method is called once connection with the server is closed (
|
|
79
|
+
*
|
|
80
|
+
* @param event
|
|
81
|
+
*/
|
|
17
82
|
protected onSocketClose(event: CloseEvent): void;
|
|
83
|
+
/**
|
|
84
|
+
* Method is called whenever a new message from socket arrives
|
|
85
|
+
* @private
|
|
86
|
+
*/
|
|
18
87
|
protected onSocketMessage(event: MessageEvent): void;
|
|
88
|
+
/**
|
|
89
|
+
* Method is called whenever an error on socket occures
|
|
90
|
+
*
|
|
91
|
+
* @param event
|
|
92
|
+
* @private
|
|
93
|
+
*/
|
|
19
94
|
protected onSocketError(event: Event): void;
|
|
20
95
|
protected onError(error: string): void;
|
|
96
|
+
/**
|
|
97
|
+
* Sends data via socket
|
|
98
|
+
* @param data
|
|
99
|
+
*/
|
|
21
100
|
sendData(data: any): void;
|
|
101
|
+
/**
|
|
102
|
+
* Returns player state e.g. NOT_INITIALIZED, STARTED, CONNECTED, ENDED
|
|
103
|
+
*/
|
|
22
104
|
getConnectionState(): ConnectionState;
|
|
105
|
+
/**
|
|
106
|
+
* Rozłacza z serwerem
|
|
107
|
+
*/
|
|
23
108
|
disconnect(byUser?: boolean): void;
|
|
109
|
+
/**
|
|
110
|
+
* Destroys connection
|
|
111
|
+
*
|
|
112
|
+
* @protected
|
|
113
|
+
*/
|
|
24
114
|
protected destroy(): void;
|
|
115
|
+
/**
|
|
116
|
+
* Returns currenly used socketURL
|
|
117
|
+
* @protected
|
|
118
|
+
*/
|
|
25
119
|
getSocketURL(): string;
|
|
26
120
|
}
|
|
@@ -1,12 +1,39 @@
|
|
|
1
1
|
import { WowzaConnection } from "./WowzaConnection";
|
|
2
2
|
import { Logger } from "../logger/Logger";
|
|
3
3
|
import { StormStreamer } from "../StormStreamer";
|
|
4
|
+
/**
|
|
5
|
+
* Main class for managing socket connections (only one per instance) and parsing packets.
|
|
6
|
+
*/
|
|
4
7
|
export declare class NetworkController {
|
|
8
|
+
/**
|
|
9
|
+
* Reference to the main class
|
|
10
|
+
* @private
|
|
11
|
+
*/
|
|
5
12
|
private readonly _main;
|
|
13
|
+
/**
|
|
14
|
+
* Object containing WebSocket Connection (only one is needed)
|
|
15
|
+
* @private
|
|
16
|
+
*/
|
|
6
17
|
private _connection;
|
|
18
|
+
/**
|
|
19
|
+
* Reference to the player logger
|
|
20
|
+
* @private
|
|
21
|
+
*/
|
|
7
22
|
protected _logger: Logger;
|
|
23
|
+
/**
|
|
24
|
+
* Current streamKey
|
|
25
|
+
* @private
|
|
26
|
+
*/
|
|
8
27
|
private _currentStreamKey;
|
|
28
|
+
/**
|
|
29
|
+
* Last state
|
|
30
|
+
* @private
|
|
31
|
+
*/
|
|
9
32
|
private _lastState;
|
|
33
|
+
/**
|
|
34
|
+
* Constructor
|
|
35
|
+
* @param main reference to the main class
|
|
36
|
+
*/
|
|
10
37
|
constructor(main: StormStreamer);
|
|
11
38
|
initialize(): void;
|
|
12
39
|
start(): void;
|
|
@@ -15,6 +42,12 @@ export declare class NetworkController {
|
|
|
15
42
|
private onServerDisconnect;
|
|
16
43
|
onMessage: (event: MessageEvent) => void;
|
|
17
44
|
sendMessage(message: String): void;
|
|
45
|
+
/**
|
|
46
|
+
* Returns current SocketConnection object
|
|
47
|
+
*/
|
|
18
48
|
getConnection(): WowzaConnection;
|
|
49
|
+
/**
|
|
50
|
+
* Returns streamKey that is currently being used
|
|
51
|
+
*/
|
|
19
52
|
getCurrentStreamKey(): string;
|
|
20
53
|
}
|
|
@@ -2,21 +2,84 @@ import { AbstractSocket } from "./AbstractSocket";
|
|
|
2
2
|
import { StormServerItem } from "../model/StormServerItem";
|
|
3
3
|
import { NetworkController } from "./NetworkController";
|
|
4
4
|
import { StormStreamer } from "../StormStreamer";
|
|
5
|
+
/**
|
|
6
|
+
* Main class for communicating with Storm Streaming Server
|
|
7
|
+
*/
|
|
5
8
|
export declare class WowzaConnection extends AbstractSocket {
|
|
9
|
+
/**
|
|
10
|
+
* Reference to the main class
|
|
11
|
+
* @private
|
|
12
|
+
*/
|
|
6
13
|
private readonly _main;
|
|
14
|
+
/**
|
|
15
|
+
* Reference to the NetworkController object
|
|
16
|
+
* @private
|
|
17
|
+
*/
|
|
7
18
|
private readonly _networkController;
|
|
19
|
+
/**
|
|
20
|
+
* Current server connection data
|
|
21
|
+
* @private
|
|
22
|
+
*/
|
|
8
23
|
private _currServer;
|
|
24
|
+
/**
|
|
25
|
+
* How long (in seconds) will it take to reconnect to a server after a failure
|
|
26
|
+
* @private
|
|
27
|
+
*/
|
|
9
28
|
private _reconnectTimer;
|
|
29
|
+
/**
|
|
30
|
+
* Constructor
|
|
31
|
+
* @param main
|
|
32
|
+
* @constructor
|
|
33
|
+
*/
|
|
10
34
|
constructor(main: StormStreamer, networkController: NetworkController);
|
|
11
35
|
initialize(): void;
|
|
36
|
+
/**
|
|
37
|
+
* On server connection opened;
|
|
38
|
+
* @param event
|
|
39
|
+
* @protected
|
|
40
|
+
*/
|
|
12
41
|
protected onSocketOpen(event: Event): void;
|
|
42
|
+
/**
|
|
43
|
+
* On server connection error
|
|
44
|
+
* @param event
|
|
45
|
+
* @protected
|
|
46
|
+
*/
|
|
13
47
|
protected onSocketError(event: Event): void;
|
|
48
|
+
/**
|
|
49
|
+
* On server connection closed
|
|
50
|
+
* @param event
|
|
51
|
+
* @protected
|
|
52
|
+
*/
|
|
14
53
|
protected onSocketClose(event: CloseEvent): void;
|
|
54
|
+
/**
|
|
55
|
+
* Method is called whenever a new message from socket arrives
|
|
56
|
+
* @private
|
|
57
|
+
*/
|
|
15
58
|
protected onSocketMessage(event: MessageEvent): void;
|
|
59
|
+
/**
|
|
60
|
+
* Creates new URL for WebSockets based on serverItem object
|
|
61
|
+
* @param serverItem
|
|
62
|
+
* @private
|
|
63
|
+
*/
|
|
16
64
|
private createURL;
|
|
65
|
+
/**
|
|
66
|
+
* Initiates reconnection procedure
|
|
67
|
+
* @private
|
|
68
|
+
*/
|
|
17
69
|
private initiateReconnect;
|
|
70
|
+
/**
|
|
71
|
+
* Picks new server from this list of available ones
|
|
72
|
+
* @param serverList
|
|
73
|
+
* @private
|
|
74
|
+
*/
|
|
18
75
|
private pickServerFromList;
|
|
76
|
+
/**
|
|
77
|
+
* Returns true/false depending if a connection with a server is active
|
|
78
|
+
*/
|
|
19
79
|
isConnectionActive(): boolean;
|
|
20
80
|
getCurrentServer(): StormServerItem | null;
|
|
81
|
+
/**
|
|
82
|
+
* Destroys object and clean-ups everything that is needed
|
|
83
|
+
*/
|
|
21
84
|
destroy(): void;
|
|
22
85
|
}
|
|
@@ -1,19 +1,73 @@
|
|
|
1
1
|
import { AbstractSocket } from "./AbstractSocket";
|
|
2
2
|
import { StormServerItem } from "../model/StormServerItem";
|
|
3
3
|
import { StormStreamer } from "../StormStreamer";
|
|
4
|
+
/**
|
|
5
|
+
* Main class for communicating with Storm Streaming Server
|
|
6
|
+
*/
|
|
4
7
|
export declare class WowzaStatusConnection extends AbstractSocket {
|
|
8
|
+
/**
|
|
9
|
+
* Reference to the main class
|
|
10
|
+
* @private
|
|
11
|
+
*/
|
|
5
12
|
private readonly _main;
|
|
13
|
+
/**
|
|
14
|
+
* Current server connection data
|
|
15
|
+
* @private
|
|
16
|
+
*/
|
|
6
17
|
private _currServer;
|
|
18
|
+
/**
|
|
19
|
+
* How long (in seconds) will it take to reconnect to a server after a failure
|
|
20
|
+
* @private
|
|
21
|
+
*/
|
|
7
22
|
private _reconnectTimer;
|
|
23
|
+
/**
|
|
24
|
+
* Constructor
|
|
25
|
+
* @param main
|
|
26
|
+
* @constructor
|
|
27
|
+
*/
|
|
8
28
|
constructor(main: StormStreamer, server: StormServerItem);
|
|
9
29
|
initialize(): void;
|
|
30
|
+
/**
|
|
31
|
+
* On server connection opened;
|
|
32
|
+
* @param event
|
|
33
|
+
* @protected
|
|
34
|
+
*/
|
|
10
35
|
protected onSocketOpen(event: Event): void;
|
|
36
|
+
/**
|
|
37
|
+
* On server connection error
|
|
38
|
+
* @param event
|
|
39
|
+
* @protected
|
|
40
|
+
*/
|
|
11
41
|
protected onSocketError(event: Event): void;
|
|
42
|
+
/**
|
|
43
|
+
* On server connection closed
|
|
44
|
+
* @param event
|
|
45
|
+
* @protected
|
|
46
|
+
*/
|
|
12
47
|
protected onSocketClose(event: CloseEvent): void;
|
|
48
|
+
/**
|
|
49
|
+
* Method is called whenever a new message from socket arrives
|
|
50
|
+
* @private
|
|
51
|
+
*/
|
|
13
52
|
protected onSocketMessage(event: MessageEvent): void;
|
|
53
|
+
/**
|
|
54
|
+
* Initiates reconnection procedure
|
|
55
|
+
* @private
|
|
56
|
+
*/
|
|
14
57
|
private initiateReconnect;
|
|
58
|
+
/**
|
|
59
|
+
* Creates new URL for WebSockets based on serverItem object
|
|
60
|
+
* @param serverItem
|
|
61
|
+
* @private
|
|
62
|
+
*/
|
|
15
63
|
private createURL;
|
|
64
|
+
/**
|
|
65
|
+
* Returns true/false depending if a connection with a server is active
|
|
66
|
+
*/
|
|
16
67
|
isConnectionActive(): boolean;
|
|
17
68
|
getCurrentServer(): StormServerItem | null;
|
|
69
|
+
/**
|
|
70
|
+
* Destroys object and clean-ups everything that is needed
|
|
71
|
+
*/
|
|
18
72
|
destroy(): void;
|
|
19
73
|
}
|
|
@@ -1,9 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simple cooldown mechanism
|
|
3
|
+
*/
|
|
1
4
|
export declare class CooldownMonitor {
|
|
2
5
|
private cooldownDuration;
|
|
3
6
|
private lastCooldownTime;
|
|
7
|
+
/**
|
|
8
|
+
* Constructs a new instance of CooldownMonitor.
|
|
9
|
+
* @param cooldownDuration The cooldown duration in seconds.
|
|
10
|
+
*/
|
|
4
11
|
constructor(cooldownDuration?: number);
|
|
12
|
+
/**
|
|
13
|
+
* Triggers the cooldown, setting the last cooldown time to the current timestamp.
|
|
14
|
+
*/
|
|
5
15
|
triggerCooldown(): void;
|
|
6
16
|
setCooldownDuration(newTime: number): void;
|
|
17
|
+
/**
|
|
18
|
+
* Checks if the cooldown is still in effect.
|
|
19
|
+
* @returns true if within cooldown period, otherwise false.
|
|
20
|
+
*/
|
|
7
21
|
isCooling(): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Resets the cooldown by setting the last cooldown time to zero.
|
|
24
|
+
*/
|
|
8
25
|
reset(): void;
|
|
9
26
|
}
|