Storm docs logo
Search the docs.../
Explore Storm Products

Resizing & Scaling - Storm JS Player Core

A core feature of the Storm JS Player Core is its ability to adapt its dimensions to the specific webpage and context in which it is displayed. The player object can be manually controlled in terms of dimensions, or it can automatically adjust itself to appropriate sizes.

Static Video Window Dimensions

In the following example, the dimensions of the player object are explicitly set to 1280x720 pixels. The player will maintain these dimensions regardless of the window or subpage size:

Static dimensions
Code iconjavascript
const streamConfig = {
  stream: {
    ... // stream setttings
  },
  settings: {
    video: {
      containerID: "container",
      width: "1280px",
      height: "720px"
    },
  }
}

Dynamic Video Window Dimensions

If the parent element of the player object in the DOM tree has specified dimensions (width and height), we can use percentage values:

Percentage dimensions
Code iconjavascript
const streamConfig = {
  stream: {
    ... // stream setttings
  },
  settings: {
    video: {
      containerID: "container",
      width: "100%",
      height: "100%"
    },
  }
}

From this moment on, whenever the size of the container element changes, the player object will automatically adapt to its parent.

If for any reason the parent element doesn't have a defined height, or the stream is meant to play in specific proportions, we can use the aspectRatio parameter. It is written as two numbers separated by a colon, e.g., "16:9", "9:16", "4:3":

Aspect ratio
Code iconjavascript
const streamConfig = {
  stream: {
    ... // stream setttings
  },
  settings: {
    video: {
      containerID: "container",
      aspectRatio: "16:9",
      width: "100%"
    },
  }
}

In this case, the player object will automatically calculate the required height based on 100% of the container's width.

Manual Control Over Dimensions

The player object supports several methods that allow us to modify its size and override the previous configuration settings:

Size methods
Code iconjavascript
storm.setSize("1280px", "720px");
storm.setSize("100%", "100%");

storm.setWidth("1280px");
storm.setWidth("100%");

storm.setHeight("720px");
storm.setHeight("100%");

When using animations where the window size changes dynamically, we can ensure the player object adjusts correctly by calling:

Update size
Code iconjavascript
storm.updateToSize();

Video Scaling

In addition to setting the player's dimensions, we can also define how the video content inside it should scale in relation to the player. This is done using the scalingMode parameter:

Scaling mode configuration
Code iconjavascript
const streamConfig = {
  stream: {
    ... // stream setttings
  },
  settings: {
    video: {
      containerID: "container",
      scalingMode: "fill",
      aspectRatio: "16:9",
      width: "100%"
    },
  }
}

The following scaling modes are available:

ModeDescription
fillThe video will stretch to fill the entire player area, without maintaining the original aspect ratio. If the aspectRatio parameter matches the stream's proportions, the video will display correctly without black bars.
letterboxThe player will attempt to maintain the original aspect ratio of the stream within the bounds of the player. This may result in black bars on the top or sides, but proportions will be preserved correctly.
cropLike letterbox, the original aspect ratio will be preserved, but the video will fill the entire player area. Some parts of the stream might be cropped and not visible. No black bars will appear.
originalThe video will be displayed in its original dimensions and centered. Depending on the player size, this may result in part of the stream being hidden or black bars appearing.
Support Needed?

If you have any questions or need assistance, please create a support ticket and our team will help you.

Blog
Support
About us
Patents
Term of use
Privacy policy
Contact
©2026 Storm Streaming Media. All Rights Reserved.