@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
|
@@ -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;
|
|
@@ -88,15 +337,32 @@ export declare class StreamerController {
|
|
|
88
337
|
setInputDeviceState(newState: InputDevicesState): void;
|
|
89
338
|
getInputDeviceState(): InputDevicesState;
|
|
90
339
|
setCameraState(newState: DeviceState): void;
|
|
91
|
-
|
|
340
|
+
getCameraState(): DeviceState;
|
|
92
341
|
setMicrophoneState(newState: DeviceState): void;
|
|
93
342
|
getMicrophoneState(): DeviceState;
|
|
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
|
}
|
|
@@ -1,11 +1,34 @@
|
|
|
1
1
|
import { StreamerController } from "../StreamerController";
|
|
2
2
|
import { Logger } from "../../logger/Logger";
|
|
3
3
|
import { StormStreamer } from "../../StormStreamer";
|
|
4
|
+
/**
|
|
5
|
+
* Abstract Player Class, gathers common fields and methods
|
|
6
|
+
*/
|
|
4
7
|
export declare class AbstractPlayer {
|
|
8
|
+
/**
|
|
9
|
+
* Reference to the main class
|
|
10
|
+
* @protected
|
|
11
|
+
*/
|
|
5
12
|
protected _main: StormStreamer;
|
|
13
|
+
/**
|
|
14
|
+
* Reference to the playback controller
|
|
15
|
+
* @protected
|
|
16
|
+
*/
|
|
6
17
|
protected _playbackController: StreamerController;
|
|
18
|
+
/**
|
|
19
|
+
* Reference to the player logger
|
|
20
|
+
* @protected
|
|
21
|
+
*/
|
|
7
22
|
protected _logger: Logger;
|
|
23
|
+
/**
|
|
24
|
+
* Reference to the VideoElement
|
|
25
|
+
* @protected
|
|
26
|
+
*/
|
|
8
27
|
protected _videoObject: HTMLVideoElement;
|
|
28
|
+
/**
|
|
29
|
+
* Numer of received data packets
|
|
30
|
+
* @protected
|
|
31
|
+
*/
|
|
9
32
|
protected _dataPacketCount: number;
|
|
10
33
|
getPlaybackRate(): number;
|
|
11
34
|
}
|
|
@@ -1,19 +1,73 @@
|
|
|
1
1
|
import { StormStreamer } from "../StormStreamer";
|
|
2
|
+
/**
|
|
3
|
+
* Class controls the VideoElement itself
|
|
4
|
+
*/
|
|
2
5
|
export declare class ScreenElement {
|
|
6
|
+
/**
|
|
7
|
+
* Decides whenever logs are being generated by this class
|
|
8
|
+
* @private
|
|
9
|
+
*/
|
|
3
10
|
private readonly LOG_ACTIVITY;
|
|
11
|
+
/**
|
|
12
|
+
* Reference to the main class
|
|
13
|
+
* @private
|
|
14
|
+
*/
|
|
4
15
|
private _main;
|
|
16
|
+
/**
|
|
17
|
+
* Current volume level
|
|
18
|
+
* @private
|
|
19
|
+
*/
|
|
5
20
|
private _volume;
|
|
21
|
+
/**
|
|
22
|
+
* Whenever video is muted
|
|
23
|
+
* @private
|
|
24
|
+
*/
|
|
6
25
|
private _isMuted;
|
|
26
|
+
/**
|
|
27
|
+
* Whenever video is muted by a browser
|
|
28
|
+
* @private
|
|
29
|
+
*/
|
|
7
30
|
private _isMutedByBrowser;
|
|
31
|
+
/**
|
|
32
|
+
* Video Element itself
|
|
33
|
+
* @private
|
|
34
|
+
*/
|
|
8
35
|
private _videoElement;
|
|
36
|
+
/**
|
|
37
|
+
* Reference to the main logger
|
|
38
|
+
* @private
|
|
39
|
+
*/
|
|
9
40
|
private _logger;
|
|
10
41
|
constructor(main: StormStreamer);
|
|
42
|
+
/**
|
|
43
|
+
* Initializes and pre-configures main video object
|
|
44
|
+
*/
|
|
11
45
|
initialize(): void;
|
|
46
|
+
/**
|
|
47
|
+
* Called whenever browser stops playback
|
|
48
|
+
*/
|
|
12
49
|
private onForceMute;
|
|
50
|
+
/**
|
|
51
|
+
* Sets new volume for playback. It'll also try to store value in a browser memory
|
|
52
|
+
* @param value
|
|
53
|
+
*/
|
|
13
54
|
setVolume(value: number): void;
|
|
14
55
|
getVolume(): number;
|
|
56
|
+
/**
|
|
57
|
+
* Allows to apply mute to a video element
|
|
58
|
+
* @param isMuted
|
|
59
|
+
*/
|
|
15
60
|
setMuted(isMuted: boolean): void;
|
|
61
|
+
/**
|
|
62
|
+
* Returns true/false whenever video is muted or not
|
|
63
|
+
*/
|
|
16
64
|
getIfMuted(): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Dispatches event informing about volume chan
|
|
67
|
+
*/
|
|
17
68
|
dispatchVolumeEvent(): void;
|
|
69
|
+
/**
|
|
70
|
+
* Return VideoElement
|
|
71
|
+
*/
|
|
18
72
|
getVideoElement(): HTMLVideoElement;
|
|
19
73
|
}
|
|
@@ -2,32 +2,118 @@ import { Logger } from "../logger/Logger";
|
|
|
2
2
|
import { ScalingType } from "../config/enum/ScalingType";
|
|
3
3
|
import { ScreenElement } from "./ScreenElement";
|
|
4
4
|
import { StormStreamer } from "../StormStreamer";
|
|
5
|
+
/**
|
|
6
|
+
* Class controls all visual elements of the player
|
|
7
|
+
*/
|
|
5
8
|
export declare class StageController {
|
|
9
|
+
/**
|
|
10
|
+
* Decides whenever logs are being generated by this class
|
|
11
|
+
* @private
|
|
12
|
+
*/
|
|
6
13
|
private static readonly LOG_ACTIVITY;
|
|
14
|
+
/**
|
|
15
|
+
* Video object itself (reference to object on document)
|
|
16
|
+
*/
|
|
7
17
|
private _screenElement;
|
|
18
|
+
/**
|
|
19
|
+
* Container that holds video object itself
|
|
20
|
+
* @private
|
|
21
|
+
*/
|
|
8
22
|
private _videoContainer;
|
|
23
|
+
/**
|
|
24
|
+
* Parent container for the player
|
|
25
|
+
* @private
|
|
26
|
+
*/
|
|
9
27
|
private _parentElement;
|
|
28
|
+
/**
|
|
29
|
+
* Video width
|
|
30
|
+
* @private
|
|
31
|
+
*/
|
|
10
32
|
private _containerWidth;
|
|
33
|
+
/**
|
|
34
|
+
* Temp container width
|
|
35
|
+
* @private
|
|
36
|
+
*/
|
|
11
37
|
private _tempContainerWidth;
|
|
38
|
+
/**
|
|
39
|
+
* Video height
|
|
40
|
+
* @private
|
|
41
|
+
*/
|
|
12
42
|
private _containerHeight;
|
|
43
|
+
/**
|
|
44
|
+
* Temp container height
|
|
45
|
+
* @private
|
|
46
|
+
*/
|
|
13
47
|
private _tempContainerHeight;
|
|
48
|
+
/**
|
|
49
|
+
* Video width (initally 0, after "onmetadata" event is updated to match the real one
|
|
50
|
+
* @private
|
|
51
|
+
*/
|
|
14
52
|
private _videoWidth;
|
|
53
|
+
/**
|
|
54
|
+
* Video width (initally 0, after "onmetadata" event is updated to match the real one
|
|
55
|
+
* @private
|
|
56
|
+
*/
|
|
15
57
|
private _videoHeight;
|
|
58
|
+
/**
|
|
59
|
+
* Current scaling type
|
|
60
|
+
* @private
|
|
61
|
+
*/
|
|
16
62
|
private _scalingMode;
|
|
63
|
+
/**
|
|
64
|
+
* If in fullscreen mode
|
|
65
|
+
* @private
|
|
66
|
+
*/
|
|
17
67
|
private isInFullScreenMode;
|
|
68
|
+
/**
|
|
69
|
+
* Reference to the main class
|
|
70
|
+
* @private
|
|
71
|
+
*/
|
|
18
72
|
private _main;
|
|
73
|
+
/**
|
|
74
|
+
* Reference to the player logger
|
|
75
|
+
* @private
|
|
76
|
+
*/
|
|
19
77
|
protected _logger: Logger;
|
|
78
|
+
/**
|
|
79
|
+
* Watches for changes in the parent container
|
|
80
|
+
* @private
|
|
81
|
+
*/
|
|
20
82
|
private _resizeObserver;
|
|
83
|
+
/**
|
|
84
|
+
* Whenever we are resizing atm.
|
|
85
|
+
* @private
|
|
86
|
+
*/
|
|
21
87
|
private _isResizing;
|
|
88
|
+
/**
|
|
89
|
+
* Deco
|
|
90
|
+
* @private
|
|
91
|
+
*/
|
|
22
92
|
private _autoResizeEnabled;
|
|
93
|
+
/**
|
|
94
|
+
* Parameter holds original overflow style
|
|
95
|
+
* @private
|
|
96
|
+
*/
|
|
23
97
|
private _parentOriginalOverflow;
|
|
24
98
|
private _debug;
|
|
25
99
|
constructor(main: StormStreamer);
|
|
26
100
|
initialize(): void;
|
|
101
|
+
/**
|
|
102
|
+
* Method attaches element to a parent container
|
|
103
|
+
*
|
|
104
|
+
* @param container
|
|
105
|
+
*/
|
|
27
106
|
attachToParent(container: string | HTMLElement): boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Detaches the library from a parent container
|
|
109
|
+
*/
|
|
28
110
|
detachFromParent(): boolean;
|
|
29
111
|
handleResize(): void;
|
|
30
112
|
private calculateNewDimensions;
|
|
113
|
+
/**
|
|
114
|
+
* Method resizes video container
|
|
115
|
+
* @private
|
|
116
|
+
*/
|
|
31
117
|
private resizeVideoContainer;
|
|
32
118
|
private scaleVideo;
|
|
33
119
|
private onFullScreenChange;
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import { StormStreamer } from "../StormStreamer";
|
|
2
2
|
import { Logger } from "../logger/Logger";
|
|
3
3
|
export declare class StatsController {
|
|
4
|
+
/**
|
|
5
|
+
* Reference to the main class
|
|
6
|
+
* @private
|
|
7
|
+
*/
|
|
4
8
|
private readonly _main;
|
|
9
|
+
/**
|
|
10
|
+
* Reference to the player logger
|
|
11
|
+
* @private
|
|
12
|
+
*/
|
|
5
13
|
protected _logger: Logger;
|
|
6
14
|
private _publishVideoWidth;
|
|
7
15
|
private _publishVideoHeight;
|
|
@@ -1,11 +1,48 @@
|
|
|
1
1
|
import { StormStreamer } from "../StormStreamer";
|
|
2
|
+
/**
|
|
3
|
+
* Saves and retrieve data from localStorage.
|
|
4
|
+
*/
|
|
2
5
|
export declare class StorageManager {
|
|
6
|
+
/**
|
|
7
|
+
* Decides whenever logs are being generated by this class
|
|
8
|
+
* @private
|
|
9
|
+
*/
|
|
3
10
|
private readonly LOG_ACTIVITY;
|
|
11
|
+
/**
|
|
12
|
+
* Whenever saving cookies is enabled at all
|
|
13
|
+
* @private
|
|
14
|
+
*/
|
|
4
15
|
private isEnabled;
|
|
16
|
+
/**
|
|
17
|
+
* Prefix for multiple instances
|
|
18
|
+
* @private
|
|
19
|
+
*/
|
|
5
20
|
private prefix;
|
|
21
|
+
/**
|
|
22
|
+
* Reference to the main logger
|
|
23
|
+
* @private
|
|
24
|
+
*/
|
|
6
25
|
private logger;
|
|
26
|
+
/**
|
|
27
|
+
* Constructor
|
|
28
|
+
* @param main
|
|
29
|
+
* @param prefix
|
|
30
|
+
*/
|
|
7
31
|
constructor(main: StormStreamer);
|
|
32
|
+
/**
|
|
33
|
+
* Saves data a a cookie
|
|
34
|
+
* @param name name of a field
|
|
35
|
+
* @param value value of a field
|
|
36
|
+
*/
|
|
8
37
|
saveField(name: string, value: string): void;
|
|
38
|
+
/**
|
|
39
|
+
* Removes a field from localStorage
|
|
40
|
+
* @param name the name of the field to remove
|
|
41
|
+
*/
|
|
9
42
|
removeField(name: string): void;
|
|
43
|
+
/**
|
|
44
|
+
* Retrieves field from cookie
|
|
45
|
+
* @param name cookie name
|
|
46
|
+
*/
|
|
10
47
|
getField(name: string): string | null;
|
|
11
48
|
}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Class responsible for operations on numbers
|
|
3
|
+
*/
|
|
1
4
|
export declare class DomUtilities {
|
|
5
|
+
/**
|
|
6
|
+
* Calculates element dimensions including margins
|
|
7
|
+
* @param element
|
|
8
|
+
*/
|
|
2
9
|
static calculateDimensionsWithMargins(element: HTMLElement): {
|
|
3
10
|
width: number;
|
|
4
11
|
height: number;
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Class responsible for operations on numbers
|
|
3
|
+
*/
|
|
1
4
|
export declare class NumberUtilities {
|
|
5
|
+
/**
|
|
6
|
+
* Adds leading "zero" before the number and returns it as a string. Example: "1" -> "01"
|
|
7
|
+
* @param number
|
|
8
|
+
*/
|
|
2
9
|
static addLeadingZero(number: number): string;
|
|
3
10
|
static isNear(currentBuffer: number, target: number, targetMargin: number): boolean;
|
|
4
11
|
static generateUniqueString(length: number): string;
|