General settings - Storm JavaScript Library
In this guide, you will get to know all the configuration options and parameters that stormLibrary can accept. Each parameter is described along with information about its types, default values, and whether it is required.
Sample configuration
const streamConfig = {
stream: {
... // stream settings
},
settings: {
autoStart: true,
restartOnFocus: true,
restartOnError: true,
reconnectTime: 1.0,
enabledProtocols: ["Storm", "HLS"],
buffer: {
minValue: 0.5,
startValue: 0.5,
maxValue: 1.5,
targetValue: 1.0,
},
video: {
scalingMode: "fill",
containerID: "container",
aspectRatio: "16:9",
width: "100%",
height: "100%",
},
audio: {
startVolume: 100,
maxVolume: 100,
rememberValue: true,
}
debug: {
console: {
enabled: true,
logTypes: [“ERROR”, ”WARNING”, ”SUCCESS”, ”INFO”, ”TRACE”],
monoColor: false,
}
}
}
};
Description of Fields and Parameters
Parameter name | Parameter type | Required | Default | Description |
---|
autoStart | boolean | No | false | Defines whether the stream playback should start immediately after the stormLibrary object is created. |
restartOnError | boolean | No | false | If set to "true", stormLibrary will attempt to restart in case of an error. |
reconnectTime | number | No | 1.0 | Specifies the delay that should occur when trying to connect to the next server instance. |
enabledProtocols | Array (string) | No | Storm, HLS | A list of protocols that stormLibrary should support (depending on the sources). Possible values are "Storm", "HLS". |
buffer | Object | No | Please check Buffer Configuration table for more info | A group of settings related to video buffering. The entire configuration is described in the Buffer Configuration table below. |
video | Object | Yes for StormLibrary, No for StormPlayer | Please check Video Configuration table for more info | A group of settings related to the video object. The entire configuration is described in the Video Configuration table below. |
audio | Object | No | Please check Audio Configuration table for more info | A group of settings related to audio volume. The entire configuration is described in the Audio Configuration table below. |
debug | Object | No | Please check Debug Configuration table for more info | A group of settings related to debugging. The entire configuration is described in the Debug Configuration table below. |
Table 1. Description of fields and parameters settings table
Buffer Configuration
Parameter name | Parameter type | Required | Default | Description |
---|
minValue | number | Yes | 0.2 | Minimum stream length (in seconds) below which buffering will start. |
startValue | number | Yes | 0.5 | Required stream length (in seconds) for it to start playing. |
maxValue | number | Yes | 0.2 | Maximum stream length (in seconds) above which the video will begin to accelerate to ensure minimal delays compared to the source material. |
targetValue | number | Yes | 0.1 | Buffer length that stormLibrary will try to maintain. |
Table 2. Buffer configuration table
Please note that while the declaration of the buffer object itself is not required, all parameters must be defined at the time of its creation.
Video Configuration
Parameter name | Parameter type | Required | Default | Description |
---|
scalingMode | string | No | fill | The provided value describes how the video should be scaled relative to its internal container. Possible values are:
- "fill": The entire video surface will be filled, potentially stretching or distorting the video to fit the container.
- "letterbox": The video will retain its original aspect ratio relative to the container, and black bars may appear to fill the remaining space if necessary.
- "crop": The video will fill the container while maintaining its original aspect ratio, and any parts of the video that exceed the container's dimensions will be cropped or hidden.
- "original": The video will be displayed at its native size, retaining its original resolution and aspect ratio within the container.
|
aspectRatio | string | Yes for StormLibrary, No for StormPlayer | - | This enforces the appropriate aspect ratio between the width and height of the video object relative to its parent container (parameter containerID). A valid parameter consists of two numbers separated by a colon, for example, "16:9" or "4:3". When calculating the aspect ratio, the value from the "width" parameter will be taken as the base value. Use with “fill” scaling Mode for best results. |
containerID | string | Yes for StormLibrary, No for StormPlayer | - | The ID of the HTML page's DOM element where the video object is to be created. It’s only required for StormLibrary. |
width | string | number | No | 100% | The width/height of the video element can be specified in the following ways:
- As a number: In this case, the value is treated as the number of pixels, and the value remains constant.
- As a string with the "px" suffix: Similar to the first option, the value is considered as the number of pixels, and the value also remains fixed.
- As a string with the "%" suffix: In this scenario, the video element's width/height will be a percentage of its parent container's value. The video will scale automatically whenever the parent container's dimensions change.
|
height |
Table 3. Video configuration table
Audio Configuration
Parameter name | Parameter type | Required | Default | Description |
---|
startVolume | number | No | 100 | The initial volume for the player. |
maxVolume | number | No | 100 | Max volume for the player. All future values will be remapped to match this value as 100%. |
rememberValue | boolean | No | true | Decides whether the player will save users volume for future use (via cookies). |
Table 4. Audio configuration table
Debug Configuration
Parameter name | Parameter type | Required | Default | Description |
---|
console | Object | No | {enabled: false} | Defines tracing options for the player that will be output to the browser’s console. For more reference, please check debug console table. |
container | Object | No | {enabled: false} | Defines tracing options for the player that will be output to the provided HTML container. For more reference, please check debug container table. |
Table 5. Debug configuration table
Debug Console Configuration
Parameter name | Parameter type | Required | Default | Description |
---|
enabled | boolean | No | false | Works as an ON/OFF switch for this option. |
logTypes | Array (string) | No | ["ERROR", "INFO", "TRACE", "WARNING", "SUCCESS"] | Decides which log types will be output using this channel. Log types are: ERROR, INFO, TRACE, WARNING, and SUCCESS. |
monoColor | boolean | No | false | By default, each log type has got its color. However, if you wish to keep logs a single color (for a specific player by given id), you can switch this option to true. |
Table 6. Debug console configuration table
Debug Container Configuration
Parameter name | Parameter type | Required | Default | Description |
---|
enabled | boolean | No | false | Works as an ON/OFF switch for this option. |
logTypes | Array (string) | No | ["ERROR", "INFO", "TRACE", "WARNING", "SUCCESS"] | Decides which log types will be output using this channel. Log types are: ERROR, INFO, TRACE, WARNING, and SUCCESS. |
containerID | string | yes | - | HTML container for the logs (id). |
monoColor | boolean | No | false | By default, each log type has got its color. However, if you wish to keep logs a single color (for a specific player by given id), you can switch this option to true. |
Table 7. Debug container configuration table