@stormstreaming/stormstreamer 0.9.2-beta.3 → 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 +2203 -102
- 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 +393 -2
- 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 +266 -0
- 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
|
}
|
|
@@ -4,80 +4,329 @@ import { InputDevice } from "./model/InputDevice";
|
|
|
4
4
|
import { PublishState } from "./enum/PublishState";
|
|
5
5
|
import { InputDevicesState } from "./enum/InputDevicesState";
|
|
6
6
|
import { DeviceState } from "./enum/DeviceState";
|
|
7
|
+
/**
|
|
8
|
+
* This class (instance) is responsible to controlling video playback. It's the central point of the whole project, where
|
|
9
|
+
* all components are being managed.
|
|
10
|
+
*/
|
|
7
11
|
export declare class StreamerController {
|
|
12
|
+
/**
|
|
13
|
+
* Reference to the main class
|
|
14
|
+
* @private
|
|
15
|
+
*/
|
|
8
16
|
private readonly _main;
|
|
17
|
+
/**
|
|
18
|
+
* Reference to the player logger
|
|
19
|
+
* @private
|
|
20
|
+
*/
|
|
9
21
|
protected _logger: Logger;
|
|
22
|
+
/**
|
|
23
|
+
* Whenever current window is active or not
|
|
24
|
+
* @private
|
|
25
|
+
*/
|
|
10
26
|
private _isWindowActive;
|
|
27
|
+
/**
|
|
28
|
+
* WebRTC Connection with Wowza Server
|
|
29
|
+
* @private
|
|
30
|
+
*/
|
|
11
31
|
private _peerConnection;
|
|
32
|
+
/**
|
|
33
|
+
* Status connection
|
|
34
|
+
* @private
|
|
35
|
+
*/
|
|
12
36
|
private _statusConnection;
|
|
37
|
+
/**
|
|
38
|
+
* Default configuration for ICE-Servers
|
|
39
|
+
* @private
|
|
40
|
+
*/
|
|
13
41
|
private _peerConnectionConfig;
|
|
42
|
+
/**
|
|
43
|
+
* MungeSDP for injecting values into WebRTC Description
|
|
44
|
+
* @private
|
|
45
|
+
*/
|
|
14
46
|
private _mungeSDP;
|
|
47
|
+
/**
|
|
48
|
+
* Currently selected camera (if ay)
|
|
49
|
+
* @private
|
|
50
|
+
*/
|
|
15
51
|
private _selectedCamera;
|
|
52
|
+
/**
|
|
53
|
+
* Currently selected microphone (if ay)
|
|
54
|
+
* @private
|
|
55
|
+
*/
|
|
16
56
|
private _selectedMicrophone;
|
|
57
|
+
/**
|
|
58
|
+
* Whenever microphone is currenly muted
|
|
59
|
+
* @private
|
|
60
|
+
*/
|
|
17
61
|
private _isMicrophoneMuted;
|
|
62
|
+
/**
|
|
63
|
+
* Desired microphone state that should be applied when stream becomes available
|
|
64
|
+
* @private
|
|
65
|
+
*/
|
|
18
66
|
private _pendingMicrophoneState;
|
|
67
|
+
/**
|
|
68
|
+
* List of all available camera devices found on user device
|
|
69
|
+
* @private
|
|
70
|
+
*/
|
|
19
71
|
private _cameraList;
|
|
72
|
+
/**
|
|
73
|
+
* List of all available microphone devices found on user device
|
|
74
|
+
* @private
|
|
75
|
+
*/
|
|
20
76
|
private _microphoneList;
|
|
77
|
+
/**
|
|
78
|
+
* The stream itself;
|
|
79
|
+
* @private
|
|
80
|
+
*/
|
|
21
81
|
private _stream;
|
|
82
|
+
/**
|
|
83
|
+
* Sound meter device
|
|
84
|
+
* @private
|
|
85
|
+
*/
|
|
22
86
|
private _soundMeter;
|
|
87
|
+
/**
|
|
88
|
+
* Whenever we have cheched for permissions
|
|
89
|
+
* @private
|
|
90
|
+
*/
|
|
23
91
|
private _permissionChecked;
|
|
92
|
+
/**
|
|
93
|
+
* A default set of permissions
|
|
94
|
+
* @private
|
|
95
|
+
*/
|
|
24
96
|
private _constraints;
|
|
97
|
+
/**
|
|
98
|
+
* Restart timer
|
|
99
|
+
* @private
|
|
100
|
+
*/
|
|
25
101
|
private _restartTimer;
|
|
102
|
+
/**
|
|
103
|
+
* Current count for restart, _restartTimerMaxCount is the max number
|
|
104
|
+
* @private
|
|
105
|
+
*/
|
|
26
106
|
private _restartTimerCount;
|
|
107
|
+
/**
|
|
108
|
+
* max
|
|
109
|
+
* @private
|
|
110
|
+
*/
|
|
27
111
|
private _restartTimerMaxCount;
|
|
112
|
+
/**
|
|
113
|
+
* Current streamer state
|
|
114
|
+
* @protected
|
|
115
|
+
*/
|
|
28
116
|
protected _publishState: PublishState;
|
|
29
117
|
protected _publishTime: number;
|
|
118
|
+
/**
|
|
119
|
+
* General state for streamer
|
|
120
|
+
* @protected
|
|
121
|
+
*/
|
|
30
122
|
protected _inputDeviceState: InputDevicesState;
|
|
123
|
+
/**
|
|
124
|
+
* Current Camera state
|
|
125
|
+
* @protected
|
|
126
|
+
*/
|
|
31
127
|
protected _cameraState: DeviceState;
|
|
128
|
+
/**
|
|
129
|
+
* Current Microphone state
|
|
130
|
+
* @protected
|
|
131
|
+
*/
|
|
32
132
|
protected _microphoneState: DeviceState;
|
|
33
133
|
protected _publishTimer: number;
|
|
34
134
|
private _currentOrientation;
|
|
35
135
|
private _statusTimer;
|
|
36
136
|
private _debug;
|
|
137
|
+
private _fullStreamName;
|
|
138
|
+
/**
|
|
139
|
+
* Constructor - requires properly configured config object
|
|
140
|
+
* @param config
|
|
141
|
+
*/
|
|
37
142
|
constructor(main: StormStreamer);
|
|
143
|
+
/**
|
|
144
|
+
* Initializes the PlaybackController by setting up event listeners and device handling
|
|
145
|
+
* This method orchestrates the initialization process by first checking device availability
|
|
146
|
+
* and permissions, then setting up necessary event listeners and configurations
|
|
147
|
+
* @private
|
|
148
|
+
*/
|
|
38
149
|
private initialize;
|
|
150
|
+
/**
|
|
151
|
+
* Sets up core event listeners for the controller
|
|
152
|
+
* @private
|
|
153
|
+
*/
|
|
39
154
|
private setupEventListeners;
|
|
155
|
+
/**
|
|
156
|
+
* Initializes media devices by checking permissions and setting up initial device lists
|
|
157
|
+
* @private
|
|
158
|
+
*/
|
|
40
159
|
private initializeDevices;
|
|
160
|
+
/**
|
|
161
|
+
* Handles device state changes and initiates publishing if appropriate
|
|
162
|
+
* @private
|
|
163
|
+
*/
|
|
41
164
|
private onDeviceStateChange;
|
|
165
|
+
/**
|
|
166
|
+
* Initializes the media stream if a camera or microphone is selected
|
|
167
|
+
* @private
|
|
168
|
+
*/
|
|
42
169
|
private initializeStream;
|
|
43
170
|
private setupPermissionListeners;
|
|
44
171
|
private handlePermissionChange;
|
|
172
|
+
/**
|
|
173
|
+
* Handles successful camera stream initialization
|
|
174
|
+
*/
|
|
45
175
|
private onCameraStreamSuccess;
|
|
176
|
+
/**
|
|
177
|
+
* Initializes WebRTC connection
|
|
178
|
+
*/
|
|
46
179
|
private initializeWebRTC;
|
|
180
|
+
/**
|
|
181
|
+
* Modified publish method to handle both camera and WebRTC
|
|
182
|
+
*
|
|
183
|
+
* @param streamKey - klucz streamu
|
|
184
|
+
* @returns {boolean} - true jeśli udało się rozpocząć publikowanie
|
|
185
|
+
*/
|
|
47
186
|
publish(streamKey: string): boolean;
|
|
48
187
|
unpublish(): void;
|
|
188
|
+
/**
|
|
189
|
+
* This method
|
|
190
|
+
* @private
|
|
191
|
+
*/
|
|
49
192
|
private setupOrientationListener;
|
|
193
|
+
/**
|
|
194
|
+
* This method is responsible for handing orientation changes for mobile devices
|
|
195
|
+
*/
|
|
50
196
|
private handleOrientationChange;
|
|
197
|
+
/**
|
|
198
|
+
* Error on trying to grab video stream (it usually means that browser does not support WebRTC streaming)
|
|
199
|
+
*
|
|
200
|
+
* @param error
|
|
201
|
+
*/
|
|
51
202
|
onUserMediaError(error: any): Promise<void>;
|
|
203
|
+
/**
|
|
204
|
+
* This method is used for checking individual access to output devices
|
|
205
|
+
* @private
|
|
206
|
+
*/
|
|
52
207
|
private checkIndividualDeviceAccess;
|
|
208
|
+
/**
|
|
209
|
+
* This method handles basic SDP/ICE-Candidate exchange with a Wowza Server
|
|
210
|
+
*
|
|
211
|
+
* @param data
|
|
212
|
+
*/
|
|
53
213
|
onSocketMessage(data: any): void;
|
|
214
|
+
/**
|
|
215
|
+
* Recives events related to peerConnection (change of state)
|
|
216
|
+
*
|
|
217
|
+
* @param event event with its data
|
|
218
|
+
* @param thisRef reference to player classonConnectionStateChange
|
|
219
|
+
* @private
|
|
220
|
+
*/
|
|
54
221
|
private onConnectionStateChange;
|
|
55
222
|
private onServerDisconnect;
|
|
223
|
+
/**
|
|
224
|
+
* Method for handling a situation when a given streamKey is already in use.
|
|
225
|
+
*/
|
|
56
226
|
private onStreamKeyTaken;
|
|
227
|
+
/**
|
|
228
|
+
* Returns list od devices (cameras, microphones) available for user's device
|
|
229
|
+
*/
|
|
57
230
|
grabDevices(): Promise<void>;
|
|
231
|
+
/**
|
|
232
|
+
* Selects camera based on camera device ID;
|
|
233
|
+
* @param cameraID
|
|
234
|
+
*/
|
|
58
235
|
selectCamera(cameraID: string): void;
|
|
236
|
+
/**
|
|
237
|
+
* Method tries to select (change) microphone based on its system ID
|
|
238
|
+
* @param micID
|
|
239
|
+
*/
|
|
59
240
|
selectMicrophone(micID: string): Promise<void>;
|
|
241
|
+
/**
|
|
242
|
+
* This method tries to start a camera.
|
|
243
|
+
*
|
|
244
|
+
* @private
|
|
245
|
+
*/
|
|
60
246
|
private startCamera;
|
|
247
|
+
/**
|
|
248
|
+
* Updates WebRTC connection with new stream
|
|
249
|
+
*/
|
|
61
250
|
private updateWebRTCStream;
|
|
251
|
+
/**
|
|
252
|
+
* Modified closeStream to handle both camera and WebRTC completely
|
|
253
|
+
*/
|
|
62
254
|
private closeStream;
|
|
255
|
+
/**
|
|
256
|
+
* This method selects a camera based on previous uses or saved IDs
|
|
257
|
+
*
|
|
258
|
+
* @private
|
|
259
|
+
*/
|
|
63
260
|
private pickCamera;
|
|
261
|
+
/**
|
|
262
|
+
* This method selects a microphone based on previous uses or saved IDs
|
|
263
|
+
*
|
|
264
|
+
* @private
|
|
265
|
+
*/
|
|
64
266
|
private pickMicrophone;
|
|
267
|
+
/**
|
|
268
|
+
* Cleans all saved cameras and microphones IDs.
|
|
269
|
+
*/
|
|
65
270
|
clearSavedDevices(): void;
|
|
271
|
+
/**
|
|
272
|
+
* Messes up camera's and microphone's id (for testing only)
|
|
273
|
+
*/
|
|
66
274
|
messSavedDevices(): void;
|
|
275
|
+
/**
|
|
276
|
+
* Handles microphone muting state
|
|
277
|
+
* @param microphoneState true to unmute, false to mute
|
|
278
|
+
*/
|
|
67
279
|
muteMicrophone(shouldMute: boolean): void;
|
|
280
|
+
/**
|
|
281
|
+
* Applies the microphone state to the actual stream tracks
|
|
282
|
+
*
|
|
283
|
+
* @param enabled true to enable tracks, false to disable
|
|
284
|
+
* @private
|
|
285
|
+
*/
|
|
68
286
|
private applyMicrophoneState;
|
|
287
|
+
/**
|
|
288
|
+
* This methods is a final check whenever we're ready to publish a stream
|
|
289
|
+
*
|
|
290
|
+
* @param requireVideo - whenever video track is required
|
|
291
|
+
* @param requireAudio - whenever audio track is required
|
|
292
|
+
* @returns {boolean} true if stream is ready for publishing
|
|
293
|
+
*/
|
|
69
294
|
isStreamReady(requireVideo?: boolean, requireAudio?: boolean): boolean;
|
|
295
|
+
/**
|
|
296
|
+
* Method fires once a connection with wowza is established. It's the main connection where we exchange
|
|
297
|
+
* ice-candidates and SDP. We'll start setting up peer connections.
|
|
298
|
+
*/
|
|
70
299
|
private onServerConnect;
|
|
300
|
+
/**
|
|
301
|
+
* Method fires once a status connection is established. We'll set an interval for monitoring stream status.
|
|
302
|
+
*/
|
|
71
303
|
private onStatusServerConnect;
|
|
72
304
|
private requestStatusData;
|
|
305
|
+
/**
|
|
306
|
+
* If for some reason the status connection is disconnected we have to clean the interval
|
|
307
|
+
*/
|
|
73
308
|
private onStatusServerDisconnect;
|
|
309
|
+
/**
|
|
310
|
+
* This event fires whenever "STREAM_STATUS_RESPONSE" packet form status connection reports stream status along some stream data. This gives
|
|
311
|
+
* us an insight into whenever our stream is ok (works) or not.
|
|
312
|
+
* @param event
|
|
313
|
+
*/
|
|
74
314
|
private onStreamStatsUpdate;
|
|
75
315
|
private closeWebRTCConnection;
|
|
76
316
|
private onDescriptionError;
|
|
77
317
|
private onDescriptionSuccess;
|
|
78
318
|
private onIceCandidate;
|
|
319
|
+
/**
|
|
320
|
+
* Methods handles visibility change events
|
|
321
|
+
*/
|
|
79
322
|
private visibilityChange;
|
|
323
|
+
/**
|
|
324
|
+
* Reacts to browser changing visibility of the document (or blur)
|
|
325
|
+
*/
|
|
80
326
|
private onWindowBlur;
|
|
327
|
+
/**
|
|
328
|
+
* Reacts to browser changing visibility of the document (or focus)
|
|
329
|
+
*/
|
|
81
330
|
private onWindowFocus;
|
|
82
331
|
createStatusConnection(): void;
|
|
83
332
|
isMicrophoneMuted(): boolean;
|
|
@@ -94,9 +343,26 @@ export declare class StreamerController {
|
|
|
94
343
|
getCameraList(): InputDevice[];
|
|
95
344
|
getMicrophoneList(): InputDevice[];
|
|
96
345
|
getPublishState(): PublishState;
|
|
346
|
+
/**
|
|
347
|
+
* Method used to stop camera from streaming
|
|
348
|
+
* @private
|
|
349
|
+
*/
|
|
97
350
|
private stopCameraStream;
|
|
351
|
+
/**
|
|
352
|
+
* Method stops streaming for all streams
|
|
353
|
+
* @private
|
|
354
|
+
*/
|
|
98
355
|
private forceStopAllStreams;
|
|
356
|
+
/**
|
|
357
|
+
* Stops all streaming operations and cleans up resources
|
|
358
|
+
*/
|
|
99
359
|
stop(): void;
|
|
360
|
+
/**
|
|
361
|
+
* Reinitializes the streaming setup
|
|
362
|
+
*/
|
|
100
363
|
start(): Promise<void>;
|
|
364
|
+
/**
|
|
365
|
+
* Method used for destroying everything (one-time use)
|
|
366
|
+
*/
|
|
101
367
|
destroy(): void;
|
|
102
368
|
}
|