Library Events - Storm JavaScript Library

Here is a list of all events emitted by the library object along with their descriptions..

Event name Additional data Description Can be fired more than once?
serverConnectionInitiate serverURL:string Fired when a library instance initiates a connection with a Storm Streaming Server/Cloud instance. yes (once per connection)
serverConnect serverURL:string Triggered when a library instance successfully establishes a connection with a Storm Streaming Server/Cloud instance. yes (once per connection)
serverDisconnect serverURL:string Called when a library instance is disconnected from the Storm Streaming Server/Cloud (after a connection was previously established), which may occur due to viewer networking issues or Storm Streaming Server/Cloud problems. yes (once per connection)
serverConnectionRestart isSilent:boolean Fired whenever a library instance needs to restart a connection with a Storm Streaming Server/Cloud instance. yes (once per connection)
serverConnectionError serverURL:string Triggered when a library instance fails to establish a connection with a Storm Streaming Server/Cloud instance, possibly due to networking issues. If there are additional servers on the configuration list and the "restartOnError" parameter is set to true, the library will attempt to connect to a different server instead. yes (once per connection)
allConnectionsFailed no Associated with serverConnectionError. If a library instance is unable to connect to any of the servers provided in the configuration list, this event indicates that no further action can be taken. no
playerReady no Triggered when a library instance is initialized via the initialize() method. no
compatibilityError no Triggered if a browser or device does not support any of the provided sources. Please note that the library will attempt all possible measures (switching between various modes) to ensure maximum compatibility with a given device. However, there may be instances where it is simply impossible to initiate a video. yes
interactionRequired no Certain browsers and devices do not permit a video element to initiate on its own and necessitate direct user interaction, such as a mouse click or a touch gesture. This event signifies that such an engagement is required. no
SSLError no Triggered if an SSL layer is required for specific sources and the browser does not provide it. no
videoElementCreate videoElement:HTMLVideoElement Triggered whenever a video element within a library instance is either created or recreated. no
authorizationError no Fired when a library instance fails to authorize with a server application on a Storm Streaming Server/Cloud instance (e.g., incorrect token). yes
authorizationComplete no Called when a library instance successfully authorizes with a server application on a Storm Streaming Server/Cloud instance. yes
invalidLicense no Fired whenever a Storm Streaming Server/Cloud license expires. no
streamConfigChange newConfig:StromStreamConfig Notifies that basic stream configuration has been updated. yes
subscriptionStart streamKey:string Fired when a subscription request is initiated. yes
subscriptionComplete streamKey:string, sourceList:ISourceItem[] Fired when a subscription request is completed. yes
subscriptionFailed streamKey:string Notifies that a subscription request has failed. yes
containerChange container:HTMLElement | null Fired whenever a library is detached or attached to a new container. yes
resizeUpdate width:number, height:number Triggered when the video size is changed or updated. yes
playbackRequest streamKey:string Indicates that a request for a stream playback has been created. yes (once per video)
playbackInitiate no Fired whenever a playback of a stream is successfully requested from a Storm Streaming Server/Cloud instance. yes (once per video)
playbackStart no Notifies that video playback has started (video is now playing). yes
playbackPause no Notifies that video playback has been paused (due to end-user or system interaction). yes
playbackProgress playbackStarTime:number, playbackDuration:number, streamStartTime:number, streamDuration:number, dvrCacheSize:number Informs on video progress, stream/playback start-time, stream/playback duration and nDVR cache size. yes
playbackStateChange state: PlaybackState Informs on video playback state change. yes
streamStateChange state: StreamState Notifies that stream state has changed (stream state always refers to the original stream on a server). yes
streamStop no Called when the stream is closed on the server side (usually it means that the broadcaster has stopped streaming, or stream was unpublished). yes
streamNotFound no Called whenever a stream with a specific name was not found on the server (this includes hibernated streams or sub-streams). yes (once per video)
streamMetadataUpdate metadata: StreamMetadata Informs of metadata arrival for current video. MetaData contains information about stream codecs, width, height, bitrate, etc. yes
bufferingStart no Indicates that video content is being readied for playback. The video buffer must fill in order for the video to start. yes
bufferingComplete no Indicates that the buffer is full and playback is about to start. yes
volumeChange volume:number, muted:boolean, invokedBy:user | browser Notifies that video volume was changed (either its value was changed, or video was muted/un-muted). yes
playbackError no Indicates that there was a problem with the playback (it usually means that the browser was not able to play a source material due to malformed bitcode). yes (once per video)
fullScreenEnter no Fired whenever a library instance enters browser fullscreen mode (either native or overlay type). yes
fullScreenExit no Fired whenever a library instance exits fullscreen mode (either native or overlay type). yes
qualityListUpdate qualityList:QualityItem[] Fired whenever a list of available qualities (substreams) is updated. yes
sourceDowngrade bandwidthCap:number Fired when the video source is downgraded due to bandwidth limitations. yes
Table 1. Library events table

Objects & Enums

PlaybackState Enum
Value Description
INITIALIZED Component has been initialized.
PLAYING Stream is playing.
BUFFERING Stream is buffering.
PAUSED Stream was paused by user or a browser.
STOPPED Stream has been stopped.
UNKNOWN Unknown state.
Table 2. PlaybackState Enum table.
StreamState Enum
Value Description
NOT_INITIALIZED Stream has not been initialized.
INITIALIZED Stream has been initialized.
NOT_FOUND Stream has not been found.
AWAITING Stream exists, but there is no data yet.
NOT_PUBLISHED Stream exists, but hasn't been published.
PUBLISHED Stream exists and it's published (can stream).
UNPUBLISHED Stream exists, but has been unublished.
STOPPED Stream existed, but has been stopped (server-side).
CLOSED Stream existed, but has been removed (server-side).
UNKNOWN Stream status is unknown (there is no connection a the server).
ERROR Error while retrieving stream status.
Table 3. StreamState Enum table.
StreamMetadata Object
Field Return Value Description
videoWidth number Width of the video frame in pixels.
videoHeight number Height of the video frame in pixels.
videoTimeScale number Time unit for video timestamps, typically expressed in Hz.
constantFrameRate boolean Indicates whether the video stream has a constant frame rate (true) or variable frame rate (false).
videoDataRate number Bit rate of the video stream expressed in bits per second (bps).
frameRate number Number of frames per second in the video stream.
encoder string Name of the software or hardware encoder used to encode the video stream.
videoCodec string Codec used for video compression (e.g., H.264, H.265, VP9).
audioCodec string Codec used for audio compression (e.g., AAC, MP3, Opus).
audioChannels number Number of audio channels in the stream (e.g., 2 for stereo, 6 for 5.1 surround).
audioSampleRate number Audio sampling rate expressed in Hz (e.g., 44100, 48000).
audioSampleSize number Bit depth of audio samples (e.g., 16, 24, 32).
audioDataRate number Bit rate of the audio stream expressed in bits per second (bps).
Table 3. StreamMetadata Object table.
QualityItem Object
Field Return Value Description
id number Returns the quality item ID, which can later be used to activate this particular quality.
label string Returns the quality label, which consists of the vertical resolution and "p", e.g., "1080p".
monogram string Returns the monogram for this quality based on its resolution, e.g., "LQ", "SD", "HD", "FH", "2K", "4K".
isAuto boolean Returns true if this quality item is of the auto type.
Table 4. QualityItem Object table.
Next Step

For the next step please check our Storm JavaScript Library - API Methods where you’ll learn about available API methods.

Support Needed?

Create a free ticket and our support team will provide you necessary assistance.