Create a free ticket and our support team will provide you necessary assistance.
| Method name | Returns | Return type | Description |
|---|---|---|---|
| initialize() | - | void | Activates all scripts within a library instance. All event-listeners should be already attached to the library at this point. |
| isInitialized() | true if this library instance was already initialized. | boolean | Returns true if this library instance has already been initialized. |
| isConnected() | true if this library instance is connected with a server. | boolean | Returns true if this library instance is connected to a server. . |
| isAuthorized() | true if this library instance is authorized with a server. | boolean | Returns true if this library instance is authorized with a server. . |
| getLibraryID() | Library ID (first instance starts with 0, next one gets 1, etc.) | number | This method returns the instance ID of the library. |
| getVersion() | Library version in xx.xx.xx format. | string | This method returns library version. |
| play() | - | void | This method will initiate 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 library must be subscribed to a stream (check the streamKey field in the config and/or the subscribe method) |
| pause() | - | void | This method pauses current playback. |
| stop() | - | void | This method will stop the current playback and cease all operations. It'll also disconnect library from a server. To restore connection, use subscribe() method. |
| togglePlay() | - | void | This method will work as a pause/play switch depending on the current object state. |
| isPlaying() | true if playback is active. | boolean | Returns true/false depending on current library state. Please check “getPlaybackState()” for more detailed information. |
| getPlaybackState() | "NOT_INITIALIZED", "INITIALIZED", "PLAYING", "PAUSED", "BUFFERING", "STOPPED", "UNKNOWN" | string | Returns current library state. |
| getStreamState() | "AWAITING", "NOT_PUBLISHED", "UNPUBLISHED", "PUBLISHED", "CLOSED", "UNKNOWN" | string | Returns current stream state. |
| seek(time: number) | - | void | Seeks stream to a given time (stream source timestamp). |
| mute() | - | void | Mutes the library’s video object. It’s not the same as setVolume(0), as both methods can be applied together. |
| unmute() | - | void | The method unmutes the library’s video object. |
| toggleMute() | - | void | Switches mute on/off. |
| isMute() | true if the library is muted. | boolean | This method can be used to check whether the library is muted. |
| setVolume(newVolume: number) | - | void | Sets new volume for the library (0-100). Once the method is performed 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-100 | number | Returns library volume (0-100). |
| setSize(width: number | string, height: number | string) | - | void | The method sets 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) | - | void | The method sets a new width for the video element. 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 width | number | Returns main Video Object width in pixels. |
| setHeight(height: number | string) | - | void | The method sets a new height for the video element. 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 height | number | Returns main Video Object height in pixels. |
| updateToSize() | - | void | This method forces the library to recalculate its size based on parent internal dimensions. |
| setScalingMode(newMode: string) | - | void | Changes library scaling mode. For reference, please check scaling mode in the library config. |
| getScalingMode() | Current scaling mode | string | Returns current library scaling mode. For reference, please check scaling mode in the library config. |
| setStreamConfig(config: StormStreamConfig) | - | void | Sets stream config for the library (or overwrites an existing one). |
| getStreamConfig() | Storm Streaming Configuration object | StormStreamingConfig | Returns current config for the library. |
| destroy() | - | void | Destroys the library instance and removes it from the container. |
| addEventListener(eventName: string, callback: function, removable: boolean = true) | - | void | Registers an event with a library instance. Whenever a registered event occurs, the library will call a provided function. |
| removeEventListener(eventName: string, callback: function) | - | void | Removes event listener from the library. If callback is not provided all events of that type will be removed. |
| removeAllEventListeners() | - | void | Removes all removable event listener from the library. |
| getSourceItemList() | Array containing available sources. | ISourceItem[] | Returns an array of all available source items. |
| removeAllSources() | - | void | Removes all SourceItems from a library instance. This method however will not stop current playback. |
| playSource(sourceItem: ISourceItem) | - | void | This method will start a playback of a provided Stream Source Item. |
| getCurrentSourceItem() | ISourceItem object or null. | ISourceItem | null | Returns current source item. If no source was selected yet, null might be returned instead. |
| addSourceItem(sourceItem: SourceItem, addAndPlay: boolean) | - | void | Add new stream object to the library. It can also start playing it automatically. |
| attachToContainer(container:ID | HTMLElement) | true if attaching was successful. | boolean | Attaches the library to a new parent container using either a container ID (string) or a reference to an HTMLElement. If the instance is already attached it'll be moved to a new parent. |
| detachFromContainer() | true if attaching was successful. | boolean | Detaches the library from the current parent element, if possible. |
| getContainer() | Parent HTMLElement or null . | HTMLElement | null | Returns the current parent element of the library, or null if none exists. |
| enterFullScreen() | - | void | Enters the FullScreen mode. |
| exitFullScreen() | - | void | Exits the FullScreen mode. |
| isFullScreenMode() | true if the library is in FullScreen mode. | void | Returns true/false whenever a library instance is in the FullScreen mode. |
| getAbsoluteStreamTime() | Unixtime | number | Returns current playback time. |
| getVideoElement() | Reference to the main Video Element. | HTMLVideoElement | Returns Video Element used by this library instance. |
Create a free ticket and our support team will provide you necessary assistance.