@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.
Files changed (51) hide show
  1. package/README.md +130 -3
  2. package/dist/amd/index.js +2206 -105
  3. package/dist/cjs/index.js +3 -3
  4. package/dist/esm/index.js +3 -3
  5. package/dist/iife/index.js +4 -4
  6. package/dist/types/StormStreamer.d.ts +394 -3
  7. package/dist/types/config/AudioData.d.ts +46 -0
  8. package/dist/types/config/ConfigManager.d.ts +47 -0
  9. package/dist/types/config/DebugData.d.ts +108 -0
  10. package/dist/types/config/IConfig.d.ts +3 -0
  11. package/dist/types/config/SettingsData.d.ts +114 -0
  12. package/dist/types/config/StorageData.d.ts +46 -0
  13. package/dist/types/config/StreamData.d.ts +75 -0
  14. package/dist/types/config/VideoData.d.ts +115 -0
  15. package/dist/types/config/enum/LogType.d.ts +3 -0
  16. package/dist/types/config/enum/ProtocolType.d.ts +3 -0
  17. package/dist/types/config/enum/ScalingType.d.ts +3 -0
  18. package/dist/types/config/enum/SecurityType.d.ts +3 -0
  19. package/dist/types/config/enum/SizeCalculationType.d.ts +3 -0
  20. package/dist/types/events/EventDispatcher.d.ts +34 -0
  21. package/dist/types/graph/MicrophoneGraph.d.ts +11 -0
  22. package/dist/types/logger/Logger.d.ts +103 -0
  23. package/dist/types/model/AbstractSourceItem.d.ts +23 -0
  24. package/dist/types/model/GatewayServerItem.d.ts +53 -0
  25. package/dist/types/model/IServerItem.d.ts +3 -0
  26. package/dist/types/model/ISourceItem.d.ts +3 -0
  27. package/dist/types/model/IStreamItem.d.ts +3 -0
  28. package/dist/types/model/RTMPSourceItem.d.ts +50 -0
  29. package/dist/types/model/RTSPSourceItem.d.ts +50 -0
  30. package/dist/types/model/StormMetaDataItem.d.ts +3 -0
  31. package/dist/types/model/StormServerItem.d.ts +53 -0
  32. package/dist/types/model/StormSourceItem.d.ts +27 -0
  33. package/dist/types/model/StreamInfo.d.ts +46 -0
  34. package/dist/types/network/AbstractSocket.d.ts +94 -0
  35. package/dist/types/network/NetworkController.d.ts +33 -0
  36. package/dist/types/network/WowzaConnection.d.ts +63 -0
  37. package/dist/types/network/WowzaStatusConnection.d.ts +54 -0
  38. package/dist/types/playback/CooldownMonitor.d.ts +17 -0
  39. package/dist/types/playback/StreamerController.d.ts +267 -1
  40. package/dist/types/playback/enum/ConnectionState.d.ts +3 -0
  41. package/dist/types/playback/player/AbstractPlayer.d.ts +23 -0
  42. package/dist/types/playback/task/IPlaybackTask.d.ts +3 -0
  43. package/dist/types/stage/ScreenElement.d.ts +54 -0
  44. package/dist/types/stage/StageController.d.ts +86 -0
  45. package/dist/types/statistics/StatsController.d.ts +8 -0
  46. package/dist/types/storage/StorageManager.d.ts +37 -0
  47. package/dist/types/utilities/DomUtilities.d.ts +7 -0
  48. package/dist/types/utilities/NumberUtilities.d.ts +7 -0
  49. package/dist/types/utilities/UserCapabilities.d.ts +44 -0
  50. package/dist/umd/index.js +4 -4
  51. package/package.json +1 -1
@@ -2,36 +2,144 @@ import { IConfig } from "./IConfig";
2
2
  import { LogType } from "./enum/LogType";
3
3
  import { Logger } from "../logger/Logger";
4
4
  import { DebugConfig } from "../types/DebugConfig";
5
+ /**
6
+ * This class represents "debug" section of an original player config. If any field/value is missing in the config,
7
+ * default values defined within this class will be used instead.
8
+ */
5
9
  export declare class DebugData implements IConfig {
10
+ /**
11
+ * Decides whenever player will print this config data on startup
12
+ *
13
+ * @private
14
+ */
6
15
  private static readonly PRINT_ON_STARTUP;
16
+ /**
17
+ * A part of an original config with parameters for debug settings
18
+ *
19
+ * @private
20
+ */
7
21
  private _debugConfig;
22
+ /**
23
+ * Decides whenever log will be outputted in browser console
24
+ * @private
25
+ */
8
26
  private _consoleLogEnabled;
27
+ /**
28
+ * List of enabled console log types (order doesn't matter)
29
+ * @private
30
+ */
9
31
  private _enabledConsoleTypes;
32
+ /**
33
+ * If true, different types of logs for console will have the same color, but each player will have
34
+ * its own color (easier to debug with multiple players)
35
+ *
36
+ * @private
37
+ */
10
38
  private _consoleMonoColor;
39
+ /**
40
+ * List of enabled console log types (order doesn't matter)
41
+ * @private
42
+ */
11
43
  private _containerLogEnabled;
44
+ /**
45
+ *
46
+ * @private
47
+ */
12
48
  private _enabledContainerTypes;
49
+ /**
50
+ * Name of the DOM container where logs will be added
51
+ * @private
52
+ */
13
53
  private _containerID;
54
+ /**
55
+ * If true, different types of logs for container will have the same color, but each player will have
56
+ * its own color (easier to debug with multiple players)
57
+ *
58
+ * @private
59
+ */
14
60
  private _containerLogMonoColor;
15
61
  private _stageController;
16
62
  private _streamerController;
63
+ /**
64
+ * Creates debug object based on parameters from config object
65
+ *
66
+ * @param debugConfig
67
+ */
17
68
  constructor(debugConfig: DebugConfig | null);
69
+ /**
70
+ * Parses provided config
71
+ */
18
72
  parse(debugConfig: DebugConfig | null): void;
19
73
  private parseLogTypes;
74
+ /**
75
+ * Returns whenever logs from debug will be pushed to browser console. False by default.
76
+ */
20
77
  get consoleLogEnabled(): boolean;
78
+ /**
79
+ * Sets console logging on/off
80
+ * @param newValue
81
+ */
21
82
  set consoleLogEnabled(newValue: boolean);
83
+ /**
84
+ * Returns all enabled types of logs for console logging
85
+ */
22
86
  get enabledConsoleTypes(): Array<LogType>;
87
+ /**
88
+ * Sets console log types
89
+ * @param newValue
90
+ */
23
91
  set enabledConsoleTypes(newValue: Array<string>);
92
+ /**
93
+ * Returns whenever logs from debug will be pushed to a cointainer. False by default.
94
+ */
24
95
  get containerLogEnabled(): boolean;
96
+ /**
97
+ * Sets container debugging on/off
98
+ * @param newValue
99
+ */
25
100
  set containerLogEnabled(newValue: boolean);
101
+ /**
102
+ * Retruns true if all console outputs will have the same color (depending on playerID)
103
+ */
26
104
  get consoleLogMonoColor(): boolean;
105
+ /**
106
+ * Sets console logging to monocolor
107
+ * @param newValue
108
+ */
27
109
  set consoleLogMonoColor(newValue: boolean);
110
+ /**
111
+ * Returns all enabled types of logs for container logging
112
+ */
28
113
  get enabledContainerTypes(): Array<LogType>;
114
+ /**
115
+ * Sets console log types
116
+ * @param newValue
117
+ */
29
118
  set enabledContainerTypes(newValue: Array<string>);
119
+ /**
120
+ * Return a reference to a object where logs will be pushed as text. Null by default.
121
+ */
30
122
  get containerID(): string | null;
123
+ /**
124
+ * Sets container for logging
125
+ * @param object
126
+ */
31
127
  set containerID(object: string);
128
+ /**
129
+ * Retruns true if all container outputs will have the same color (depending on playerID)
130
+ */
32
131
  get containerLogMonoColor(): boolean;
132
+ /**
133
+ * Sets container logging to monocolor
134
+ * @param newValue
135
+ */
33
136
  set containerLogMonoColor(newValue: boolean);
34
137
  get stageControllerDebug(): boolean;
35
138
  get streamerControllerDebug(): boolean;
139
+ /**
140
+ * Prints current settings
141
+ *
142
+ * @param logger
143
+ */
36
144
  print(logger: Logger, force?: boolean): void;
37
145
  }
@@ -1,4 +1,7 @@
1
1
  import { Logger } from "../logger/Logger";
2
+ /**
3
+ * Interface for all configs within the player
4
+ */
2
5
  export interface IConfig {
3
6
  print(logger: Logger, force: boolean): void;
4
7
  }
@@ -5,37 +5,151 @@ import { AudioData } from "./AudioData";
5
5
  import { Logger } from "../logger/Logger";
6
6
  import { SettingsConfig } from "../types/SettingsConfig";
7
7
  import { StorageData } from "./StorageData";
8
+ /**
9
+ * Store all settings related to player behavior
10
+ */
8
11
  export declare class SettingsData implements IConfig {
12
+ /**
13
+ * Decides whenever player will print this config data on startup
14
+ *
15
+ * @private
16
+ */
9
17
  private static readonly PRINT_ON_STARTUP;
18
+ /**
19
+ * Raw config provided for the player
20
+ *
21
+ * @private
22
+ */
10
23
  private _settingsConfig;
24
+ /**
25
+ * Whenver player should try reconnecting upon its error
26
+ * @private
27
+ */
11
28
  private _restartOnError;
29
+ /**
30
+ * Number of seconds between player reconnects
31
+ * @private
32
+ */
12
33
  private _reconnectTime;
34
+ /**
35
+ * Decides whenver player will automatically start playing content
36
+ * @private
37
+ */
13
38
  private _autoStart;
39
+ /**
40
+ * Decides whenver player will automatically connect to a server
41
+ * @private
42
+ */
14
43
  private _autoConnect;
44
+ /**
45
+ * Start player only when DOM is ready
46
+ *
47
+ * @private
48
+ */
15
49
  private startOnDOMReady;
50
+ /**
51
+ * Starts video playback on iOS only once DOM is ready
52
+ *
53
+ * @private
54
+ *
55
+ */
16
56
  private iOSOnDomReadyFix;
57
+ /**
58
+ * Contains configuration related to video
59
+ * @private
60
+ */
17
61
  private _videoData;
62
+ /**
63
+ * Contains configuration related to logger/debugger
64
+ * @private
65
+ */
18
66
  private _debugData;
67
+ /**
68
+ * Contains configuration related to storing user data
69
+ * @private
70
+ */
19
71
  private _storageData;
72
+ /**
73
+ * Contains configuration related to volume
74
+ * @private
75
+ */
20
76
  private _audioData;
77
+ /**
78
+ * Decides whenever player will restart on focus/blur
79
+ * @private
80
+ */
21
81
  private _restartOnFocus;
82
+ /**
83
+ * Whenever streamer should preselect some camera and microphone if no was selected prior
84
+ * @private
85
+ */
22
86
  private _preselectDevices;
23
87
  private _cancelPublishOnError;
88
+ /**
89
+ * Constructor
90
+ * @param config
91
+ */
24
92
  constructor(config: SettingsConfig);
93
+ /**
94
+ * Parses provided config
95
+ * @param config
96
+ */
25
97
  parse(config: SettingsConfig): void;
98
+ /**
99
+ * Returns Volume Config
100
+ */
26
101
  getAudioData(): AudioData;
102
+ /**
103
+ * Returns Video Config
104
+ */
27
105
  getVideoData(): VideoData;
106
+ /**
107
+ * Returns Storage Data
108
+ */
28
109
  getStorageData(): StorageData;
110
+ /**
111
+ * Returns if player should reset connection after error
112
+ */
29
113
  getIfRestartOnError(): boolean;
114
+ /**
115
+ * Returns time (in ms) when player should attempt new connection after error
116
+ */
30
117
  getReconnectTime(): number;
118
+ /**
119
+ * Returns true whenever autostart is activated
120
+ */
31
121
  get autoStart(): boolean;
122
+ /**
123
+ * Sets autostart value
124
+ * @param newValue
125
+ */
32
126
  set autoStart(newValue: boolean);
127
+ /**
128
+ * Returns true/false whenever library is set to auto-connect with a Storm server
129
+ */
33
130
  get autoConnect(): boolean;
131
+ /**
132
+ * Returns true whenever library should restart the connection on document focus/blur
133
+ */
34
134
  get restartOnFocus(): boolean;
135
+ /**
136
+ * Returns Debug Config
137
+ */
35
138
  getDebugData(): DebugData;
36
139
  getIfForceSelection(): boolean;
37
140
  getIfCancelPublishOnError(): boolean;
141
+ /**
142
+ * Returns whenever player should start only after DOM has been initialized
143
+ */
38
144
  getIfStartOnDOMReadyEnabled(): boolean;
145
+ /**
146
+ * Returns whenever player (ios mode) should start only after DOM has been initialized
147
+ */
39
148
  getIfIOSOnDomStartFixEnabled(): boolean;
149
+ /**
150
+ * Prints current settings
151
+ *
152
+ * @param logger
153
+ */
40
154
  print(logger: Logger, force?: boolean): void;
41
155
  }
@@ -1,16 +1,62 @@
1
1
  import { Logger } from "../logger/Logger";
2
2
  import { IConfig } from "./IConfig";
3
3
  import { StorageConfig } from "../types/StorageConfig";
4
+ /**
5
+ * Class contains all parameters related to volume
6
+ */
4
7
  export declare class StorageData implements IConfig {
8
+ /**
9
+ * Decides whenever player will print this config data on startup
10
+ *
11
+ * @private
12
+ */
5
13
  private static readonly PRINT_ON_STARTUP;
14
+ /**
15
+ * Original config object
16
+ * @private
17
+ */
6
18
  private _storageConfig;
19
+ /**
20
+ * Whenever storage is enabled or not (true by default)
21
+ * @private
22
+ */
7
23
  private _enabled;
24
+ /**
25
+ * Prefix for loading and saving settings
26
+ * @private
27
+ */
8
28
  private _prefix;
29
+ /**
30
+ * Constructor
31
+ * @param storageConfig
32
+ */
9
33
  constructor(storageConfig: StorageConfig | null);
34
+ /**
35
+ * Parses provided config
36
+ */
10
37
  parse(config: StorageConfig | null): void;
38
+ /**
39
+ * Returns if storage is enabled
40
+ */
11
41
  get enabled(): boolean;
42
+ /**
43
+ * Sets new value for enabled
44
+ * @param newValue
45
+ */
12
46
  set enabled(newValue: boolean);
47
+ /**
48
+ * Returns storage prefix
49
+ */
13
50
  get prefix(): string;
51
+ /**
52
+ * Sets storage prefix
53
+ * @param newValue
54
+ */
14
55
  set prefix(newValue: string);
56
+ /**
57
+ * Prints current settings
58
+ *
59
+ * @param logger
60
+ */
15
61
  print(logger: Logger, force?: boolean): void;
16
62
  }
@@ -2,24 +2,99 @@ import { StormServerItem } from "../model/StormServerItem";
2
2
  import { ISourceItem } from "../model/ISourceItem";
3
3
  import { Logger } from "../logger/Logger";
4
4
  import { StreamConfig } from "../types/StreamConfig";
5
+ /**
6
+ * Class contains streaming data
7
+ */
5
8
  export declare class StreamData {
9
+ /**
10
+ * Decides whenever player will print this config data on startup
11
+ *
12
+ * @private
13
+ */
6
14
  private static readonly PRINT_ON_STARTUP;
15
+ /**
16
+ * Default storm port (usually 443)
17
+ * @private
18
+ */
7
19
  private static readonly DEFAULT_CONNECTION_PORT;
20
+ /**
21
+ * Whenever all connection to strom should be made via SSL
22
+ * @private
23
+ */
8
24
  private static readonly IS_SSL_BY_DEFAULT;
25
+ /**
26
+ * Original config file
27
+ * @private
28
+ */
9
29
  private _streamConfig;
30
+ /**
31
+ * List of all servers (Storm)
32
+ * @private
33
+ */
10
34
  private _serverList;
35
+ /**
36
+ * List of all sources (usually the same video, but in a different resolution)
37
+ * @private
38
+ */
11
39
  private _sourceList;
40
+ /**
41
+ * Contains stream data (for publishing aka Streamer mode)
42
+ * @private
43
+ */
12
44
  private publishData;
45
+ /**
46
+ * Group name for gateway server
47
+ * @private
48
+ */
13
49
  private _streamKey;
50
+ /**
51
+ * Constructor
52
+ * @param streamConfig
53
+ */
14
54
  constructor(streamConfig: StreamConfig);
55
+ /**
56
+ * Parses provided config
57
+ */
15
58
  parse(streamConfig: StreamConfig): void;
59
+ /**
60
+ * Returns list of all provided servers
61
+ */
16
62
  getServerList(): Array<StormServerItem>;
63
+ /**
64
+ * Returns list of all video sources
65
+ */
17
66
  getSourceList(): Array<ISourceItem>;
67
+ /**
68
+ * Returns group name;
69
+ */
18
70
  get streamKey(): string | null;
71
+ /**
72
+ * Returns group name;
73
+ */
19
74
  set streamKey(newValue: string | null);
75
+ /**
76
+ * Allows to push server list to the config
77
+ * @param serverList
78
+ */
20
79
  set serverList(serverList: Array<StormServerItem>);
80
+ /**
81
+ * Allows to push source list to the config
82
+ * @param sourceList
83
+ */
21
84
  set sourceList(sourceList: Array<ISourceItem>);
85
+ /**
86
+ * Removes all sources
87
+ */
22
88
  clearSourceList(): void;
89
+ /**
90
+ * Removes all SERVERS
91
+ */
23
92
  clearServerList(): void;
93
+ /**
94
+ * Prints current settings.
95
+ *
96
+ * @param logger reference to logger
97
+ * @param force if printing is disabled, this parameter can overwrite it
98
+ */
24
99
  print(logger: Logger, force?: boolean): void;
25
100
  }
@@ -3,38 +3,153 @@ import { ScalingType } from "./enum/ScalingType";
3
3
  import { Logger } from "../logger/Logger";
4
4
  import { VideoConfig } from "../types/VideoConfig";
5
5
  import { SizeCalculationType } from "./enum/SizeCalculationType";
6
+ /**
7
+ * Class contains settings for video object
8
+ */
6
9
  export declare class VideoData implements IConfig {
10
+ /**
11
+ * Original config
12
+ * @private
13
+ */
7
14
  private videoConfig;
15
+ /**
16
+ * Selected scaling mode
17
+ * @private
18
+ */
8
19
  private _scalingMode;
20
+ /**
21
+ * Container ID for video object (must be created prior to starting the player)
22
+ * @private
23
+ */
9
24
  private _containerID;
25
+ /**
26
+ * Aspect ratio saved as a string (two numbers with : in between)
27
+ * @private
28
+ */
10
29
  private _aspectRatio;
30
+ /**
31
+ * Initial video container width
32
+ * @private
33
+ */
11
34
  private _videoWidthValue;
35
+ /**
36
+ * Whenever width is in pixels
37
+ * @private
38
+ */
12
39
  private _isVideoWidthInPixels;
40
+ /**
41
+ * Whenever width was provided
42
+ * @private
43
+ */
13
44
  private _wasVideoWidthProvided;
45
+ /**
46
+ * Initial video container height;
47
+ * @private
48
+ */
14
49
  private _videoHeightValue;
50
+ /**
51
+ * Whenever height is in pixels
52
+ * @private
53
+ */
15
54
  private _isVideoHeightInPixels;
55
+ /**
56
+ * Whenever height was provided
57
+ * @private
58
+ */
16
59
  private _wasVideoHeightProvided;
60
+ /**
61
+ * Resize debounce parameter
62
+ * @private
63
+ */
17
64
  private _resizeDebounce;
65
+ /**
66
+ * Method used for calculating parent size;
67
+ * @private
68
+ */
18
69
  private _parentSizeCalculationMethod;
70
+ /**
71
+ * Constructor
72
+ *
73
+ * @param videoConfig video config object
74
+ */
19
75
  constructor(videoConfig: VideoConfig | null);
76
+ /**
77
+ * Parses provided config
78
+ */
20
79
  parse(config: VideoConfig | null): void;
80
+ /**
81
+ * Returns selected scaling mode
82
+ */
21
83
  get scalingMode(): ScalingType;
84
+ /**
85
+ * Returns ID of the main video container
86
+ */
22
87
  get containerID(): string | null;
88
+ /**
89
+ * Returns video screen initial width
90
+ */
23
91
  get videoWidthValue(): number;
92
+ /**
93
+ * Returns whenever screen width was provided in pixels
94
+ */
24
95
  get videoWidthInPixels(): boolean;
96
+ /**
97
+ * Returns whenever screen width was provided in pixels
98
+ */
25
99
  get videoWidthProvided(): boolean;
100
+ /**
101
+ * Returns video container initial width
102
+ */
26
103
  get videoHeightValue(): number;
104
+ /**
105
+ * Returns video container initial width
106
+ */
27
107
  get videoHeightInPixels(): boolean;
108
+ /**
109
+ * Returns whenever screen width was provided in pixels
110
+ */
28
111
  get videoHeightProvided(): boolean;
112
+ /**
113
+ * Returns aspect ratio;
114
+ */
29
115
  get aspectRatio(): string;
30
116
  get resizeDebounce(): number;
31
117
  set resizeDebounce(newValue: number);
118
+ /**
119
+ * Sets new width to the player config
120
+ * @param newWidth
121
+ */
32
122
  set videoWidthValue(newWidth: number);
123
+ /**
124
+ * Sets new width to the player config
125
+ * @param newWidth
126
+ */
33
127
  set videoWidthInPixels(value: boolean);
128
+ /**
129
+ * Sets new height to the player config
130
+ * @param newHeight
131
+ */
34
132
  set videoHeightValue(newHeight: number);
133
+ /**
134
+ * Sets new width to the player config
135
+ * @param newWidth
136
+ */
35
137
  set videoHeightInPixels(value: boolean);
138
+ /**
139
+ * Sets new containerID for the player
140
+ * @param newContainerID
141
+ */
36
142
  set containerID(newContainerID: string);
143
+ /**
144
+ * Sets new scaling mode
145
+ * @param newScalingMode
146
+ */
37
147
  set scalingMode(newScalingMode: string);
38
148
  get parentSizeCalculationMethod(): SizeCalculationType;
149
+ /**
150
+ * Prints current settings
151
+ *
152
+ * @param logger
153
+ */
39
154
  print(logger: Logger): void;
40
155
  }
@@ -1,3 +1,6 @@
1
+ /**
2
+ * Contains all log types
3
+ */
1
4
  export declare enum LogType {
2
5
  TRACE = 0,
3
6
  INFO = 1,
@@ -1,3 +1,6 @@
1
+ /**
2
+ * Contains all known protocol types for either source or stream itself
3
+ */
1
4
  export declare enum ProtocolType {
2
5
  RTMP = "RTMP",
3
6
  RTSP = "RTSP",
@@ -1,3 +1,6 @@
1
+ /**
2
+ * Different types of video scaling mechanisms
3
+ */
1
4
  export declare enum ScalingType {
2
5
  FILL = "fill",
3
6
  LETTER_BOX = "letterbox",
@@ -1,3 +1,6 @@
1
+ /**
2
+ * Different types of security methods for player
3
+ */
1
4
  export declare enum SecurityType {
2
5
  NONE = 0,
3
6
  TOKEN = 1
@@ -1,3 +1,6 @@
1
+ /**
2
+ * Different types of security methods for player
3
+ */
1
4
  export declare enum SizeCalculationType {
2
5
  CLIENT_DIMENSIONS = "clientDimensions",
3
6
  BOUNDING_BOX = "boundingBox",