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 nameParameter typeRequiredDefaultDescription
autoStartbooleanNofalseDefines whether the stream playback should start immediately after the stormLibrary object is created.
restartOnErrorbooleanNofalseIf set to "true", stormLibrary will attempt to restart in case of an error.
reconnectTimenumberNo1.0Specifies the delay that should occur when trying to connect to the next server instance.
enabledProtocolsArray (string)NoStorm, HLSA list of protocols that stormLibrary should support (depending on the sources). Possible values are "Storm", "HLS".
bufferObjectNoPlease check Buffer Configuration table for more infoA group of settings related to video buffering. The entire configuration is described in the Buffer Configuration table below.
videoObjectYes for StormLibrary, No for StormPlayerPlease check Video Configuration table for more infoA group of settings related to the video object. The entire configuration is described in the Video Configuration table below.
audioObjectNoPlease check Audio Configuration table for more infoA group of settings related to audio volume. The entire configuration is described in the Audio Configuration table below.
debugObjectNoPlease check Debug Configuration table for more infoA 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 nameParameter typeRequiredDefaultDescription
minValuenumberYes0.2Minimum stream length (in seconds) below which buffering will start.
startValuenumberYes0.5Required stream length (in seconds) for it to start playing.
maxValuenumberYes0.2Maximum stream length (in seconds) above which the video will begin to accelerate to ensure minimal delays compared to the source material.
targetValuenumberYes0.1Buffer 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 nameParameter typeRequiredDefaultDescription
scalingModestringNofillThe 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.
aspectRatiostringYes 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.
containerIDstringYes 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.
widthstring | numberNo100%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 nameParameter typeRequiredDefaultDescription
startVolumenumberNo100The initial volume for the player.
maxVolumenumberNo100Max volume for the player. All future values will be remapped to match this value as 100%.
rememberValuebooleanNotrueDecides whether the player will save users volume for future use (via cookies).
Table 4. Audio configuration table

Debug Configuration

Parameter nameParameter typeRequiredDefaultDescription
consoleObjectNo{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.
containerObjectNo{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 nameParameter typeRequiredDefaultDescription
enabledbooleanNofalseWorks as an ON/OFF switch for this option.
logTypesArray (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.
monoColorbooleanNofalseBy 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 nameParameter typeRequiredDefaultDescription
enabledbooleanNofalseWorks as an ON/OFF switch for this option.
logTypesArray (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.
containerIDstringyes-HTML container for the logs (id).
monoColorbooleanNofalseBy 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