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

API Methods - Storm JS Player Core

Method nameReturnsReturn typeDescription
initialize()-voidInitializes the player object. From this point, a connection to the server is established and authentication occurs. It is recommended to add all event listeners before calling this method to ensure they can be properly captured.
isInitialized()true if this player instance was already initializedbooleanReturns true if this player instance has already been initialized.
isConnected()true if this player instance is connected to a serverbooleanReturns true if this player instance is connected to a server.
isAuthorized()true if this player instance is authorized with a serverbooleanReturns true if this player instance is authorized with a server.
getPlayerID()Player ID (first instance starts with 0, next one gets 1, etc.)numberReturns the ID of this player instance. Each subsequent instance has a higher number.
getBranch()Name of a development branchstringReturns the development branch of this player (e.g., main, experimental).
getVersion()Player version in xx.xx.xx formatstringReturns the version of this player instance. The version is returned in the SemVer format (Major.Minor.Patch).
getServerInfo()An object containing server infoServerInfoReturns an object containing server info like its common name, version, and protocol version.
play()-voidInitiates playback of a video stream. If a video was previously paused, you can use this method to resume playback. For this method to work, the player must be subscribed to a stream (check the streamKey field in the config and/or the subscribe method).
pause()-voidPauses current playback. To restart playback, please use the play() method.
stop()-voidStops the current playback and ceases all operations. It also disconnects the player from a server. To restore connection, use the subscribe() method.
togglePlay()-voidWorks as a pause/play switch depending on the current object state.
isPlaying()true if playback is activebooleanReturns true if this player instance is currently playing a stream. To obtain more detailed information about the stream's state, you can use the getPlaybackState() method.
getPlaybackState()Current Playback StatePlaybackStateReturns the current playback state of this player instance.
getStreamState()Current Stream StateStreamStateReturns the current stream state to which the player is subscribed.
seek(time:number)-voidSeeks stream to a given time (stream source timestamp).
mute()-voidMutes the player's video object. It's not the same as setVolume(0), as both methods can be applied together.
unmute()-voidUnmutes the player's video object.
toggleMute()-voidSwitches between mute and unmute methods depending on the current state.
isMute()true if the player is mutedbooleanChecks whether the player is muted.
setVolume(newVolume:number)-voidSets new volume for the player (0-100). Once the method is performed, the volumeChange event will be triggered. If the video was muted prior to the volume change, it will be automatically unmuted.
getVolume()Current volume level 0-100numberReturns player volume (0-100).
setSize(width:number | string, height:number | string)-voidSets a new width and height for the video element. The values can be given as a number (in which case they are treated as the number of pixels), or as a string ending with "px" (this will also be the number of pixels) or "%", where the number is treated as a percentage of the parent container's value.
setWidth(width:number | string)-voidSets a new width for the player. The value can be given as a number (in which case it is treated as the number of pixels), or as a string ending with "px" (this will also be the number of pixels) or "%", where the number is treated as a percentage of the parent container's value.
getWidth()Video object widthnumberReturns current player width in pixels.
setHeight(height:number | string)-voidSets a new height for the player. The value can be given as a number (in which case it is treated as the number of pixels), or as a string ending with "px" (this will also be the number of pixels) or "%", where the number is treated as a percentage of the parent container's value.
getHeight()Video object heightnumberReturns current player height in pixels.
updateToSize()-voidForces the player to recalculate its size based on parent internal dimensions.
setScalingMode(newMode:ScalingType)-voidChanges the player scaling mode.
getScalingMode()Current scaling modeScalingTypeReturns the current player scaling mode.
setStreamConfig(config:StormStreamConfig)-voidSets stream config for the player (or overwrites an existing one).
getStreamConfig()Storm Streaming Configuration objectStormStreamingConfigReturns the current config for the player.
makeScreenshot()A promise containing either a blob or nullPromise<Blob | null>Returns a promise that resolves with a screenshot of the video element as a blob, or null if taking the screenshot was not possible.
destroy()-voidDestroys this instance of StormPlayerCore and disconnects from a server.
addEventListener(eventName:string, callback:function, removable:boolean = true)-voidRegisters an event with a player instance. Whenever a registered event occurs, the player will call the provided function.
removeEventListener(eventName:string, callback:function)-voidRemoves event listener from the player. If callback is not provided, all events of that type will be removed.
removeAllEventListeners()-voidRemoves all removable event listeners from the player.
getSourceItemList()Array containing available sourcesISourceItem[]Returns an array of all available source items.
removeAllSources()-voidRemoves all SourceItems from a player instance. This method, however, will not stop current playback.
getQualityItemList()Array containing available stream quality optionsQualityItem[]Returns an array of all available stream quality items.
subscribe(streamKey:string, andPlay:boolean)-voidRequests a subscription to a given streamKey. When a player is subscribed to a certain streamKey, it will receive notifications regarding its status.
unsubscribe()-voidCancels subscription to a currently selected stream and stops playback.
getSubscriptionKey()Current subscription streamKeystringReturns current (last used) subscription streamKey.
playSourceItem(sourceItem:ISourceItem)-voidStarts a playback of a provided Stream Source Item.
playQualityItem(id:number)true if Source Item related to that quality was foundbooleanChanges the selected video quality to the one corresponding to the specified ID. A list of qualities can be obtained through the getQualityItemList() method.
getCurrentSourceItem()ISourceItem object or nullISourceItem | nullReturns the current source item. If no source was selected yet, null might be returned instead.
addSourceItem(sourceItem:SourceItem, addAndPlay:boolean)-voidAdds a new stream object to the player. It can also start playing it automatically.
attachToContainer(containerID:string | HTMLElement)true if attaching was successfulbooleanAttaches the player to a new parent container using either a container ID (string) or a reference to an HTMLElement. If the instance is already attached, it will be moved to a new parent.
detachFromContainer()true if detaching was successfulbooleanDetaches the player from the current parent element, if possible.
getContainer()Parent HTMLElement or nullHTMLElement | nullReturns the current parent element of the player, or null if none exists.
enterFullScreen()-voidEnters the FullScreen mode.
exitFullScreen()-voidExits the FullScreen mode.
isFullScreenMode()true if the player is in FullScreen modebooleanReturns true if the player instance is in FullScreen mode.
getAbsoluteStreamTime()UnixtimenumberReturns the current playback time.
getVideoElement()Reference to the main Video ElementHTMLVideoElementReturns the Video Element used by this instance of the player.
getQualityControlMode()Current Quality Control ModeQualityControlModeReturns the currently used quality control mode.
setQualityControlMode(mode:QualityControlMode, forceRestart:boolean = true)-voidSets the quality control mode for this player instance. You can force a reload of the mechanism, which may result in an immediate quality change.
getPlaybackRate()Playback SpeednumberReturns current playback ratio (usually between 0.9 and 1.1).
getBandwidthAnalyser()Object containing bandwidth stability statisticsBandwidthAnalyserReturns the Bandwidth Analyser component for the player. This component contains statistical data regarding the stability of the internet connection.
getBandwidthMeter()Object containing bandwidth performance statisticsBandwidthMeterReturns the Bandwidth Meter component for the player. This component contains statistical data related to the performance of the internet connection.
getBufferAnalyser()Object containing buffer state and stabilityBufferAnalyserReturns the Buffer Analyser component for the player. This component contains statistical data regarding the buffer state and its stability.
createBufferGraph(container:string | HTMLElement, interval:number)Graph for video buffer sizeBufferGraphCreates a buffer size graph in the specified location (container ID or reference). The graph is a separate object that must be started using its start() method and stopped using its stop() method. The dimensions of the graph depend on the dimensions of the specified container.
createBandwidthGraph(container:string | HTMLElement, interval:number)Graph for bandwidth speedBandwidthGraphCreates a bandwidth performance graph in the specified location (container ID or reference). The graph is a separate object that must be started using its start() method and stopped using its stop() method. The dimensions of the graph depend on the dimensions of the specified container.
createBufferStabilityGraph(container:string | HTMLElement, interval:number)Graph for buffer stabilityBufferStabilityGraphCreates a buffer stability graph in the specified location (container ID or reference). The graph is a separate object that must be started using its start() method and stopped using its stop() method. The dimensions of the graph depend on the dimensions of the specified container.

Objects & Enums

PlaybackState Enum

ValueDescription
INITIALIZEDComponent has been initialized.
PLAYINGStream is playing.
BUFFERINGStream is buffering.
PAUSEDStream was paused by user or a browser.
STOPPEDStream has been stopped.
UNKNOWNUnknown state.

StreamState Enum

ValueDescription
NOT_INITIALIZEDStream has not been initialized.
INITIALIZEDStream has been initialized.
NOT_FOUNDStream has not been found.
AWAITINGStream exists, but there is no data yet.
NOT_PUBLISHEDStream exists, but hasn't been published.
PUBLISHEDStream exists and it's published (can stream).
UNPUBLISHEDStream exists, but has been unublished.
STOPPEDStream existed, but has been stopped (server-side).
CLOSEDStream existed, but has been removed (server-side).
UNKNOWNStream status is unknown (there is no connection a the server).
ERRORError while retrieving stream status.

ScalingType Enum

ValueDescription
FILLScales content to fill the entire container, may distort aspect ratio.
LETTER_BOXScales content to fit within container while preserving aspect ratio, may add black bars.
CROPScales content to fill container while preserving aspect ratio, may crop edges.
ORIGINALDisplays content at its original size without scaling.

QualityControlMode Enum

ValueDescription
PASSIVEPlayer will use previously saved information from RESOLUTION_AWARE mode, but it'll not react to any resize.
RESOLUTION_AWAREQuality will depend on player screen size and source resolution (closest match).
HIGHEST_QUALITYPlayer will always pick the highest available quality.
LOWEST_QUALITYPlayer will always pick the lowest available quality.
UNKNOWNQuality mode has not been provided or Quality Control has not been initialized yet.

ServerInfo Object

FieldReturn ValueDescription
namestringCommon name of the server.
groupstringGroup name of the server.
protocolVersionnumberProtocol version used by the server.
serverInitTimenumberServer initialization time as Unix timestamp.
versionnumberVersion of the server protocol.

QualityItem Object

FieldReturn ValueDescription
idnumberReturns the quality item ID, which can later be used to activate this particular quality.
labelstringReturns the quality label, which consists of the vertical resolution and "p", e.g., "1080p".
monogramstringReturns the monogram for this quality based on its resolution, e.g., "LQ", "SD", "HD", "FH", "2K", "4K".
isAutobooleanReturns true if this quality item is of the auto type.
Blog
Support
About us
Patents
Term of use
Privacy policy
Contact
©2026 Storm Streaming Media. All Rights Reserved.