Constructor
new HisPlayer()
Members
(static, constant) BUFFER_TYPE :string
HISPlayer buffer types.
Properties:
| Name | Value | Type | Description |
|---|---|---|---|
CONNECTION |
Connection | string | |
INITIAL |
Initial | string | |
SEEK |
Seek | string | |
PAUSE |
Pause | string | |
BACKGROUND |
Background | string |
(static, constant) HisPlayerEvent :string
HISPlayer event types.
Properties:
| Name | Value | Type | Description |
|---|---|---|---|
ADMANAGER_READY |
adManagerReady | string | |
UIMANAGER_READY |
uiManagerReady | string | |
VRMANAGER_READY |
vrManagerReady | string | |
LICENSE_ERROR |
licenseError | string | The event has the detail field with a description error. |
STATE_CHANGE |
stateChange | string | The event has the detail field with the PLAYER_STATES. |
SEEK_BEGIN |
seekBegin | string | The event has the detail field with the
HTMLMediaElement.currentTime. |
SEEK_END |
seekEnd | string | The event has the detail field with the
HTMLMediaElement.currentTime. |
BUFFER_TYPE |
bufferType | string | |
ERROR |
error | string | |
STALL_DETECTED |
stallDetected | string | |
VIDEO_PROGRESS_TIME |
videoProgressTime | string | |
VIDEO_FIRST_QUARTILE |
videoFirstQuartile | string | |
VIDEO_MIDPOINT |
videoMidPoint | string | |
VIDEO_THIRD_QUARTILE |
videoThirdQuartile | string | |
VIDEO_COMPLETE |
videoComplete | string | |
VIDEO_TRACK_CHANGE |
videoTrackChange | string | The event has the detail field with the new track. |
SUBTITLE_TRACK_CHANGE |
subtitleTrackChange | string | The event has the detail field with the new track. |
SUBTITLES_READY |
subtitlesReady | string | |
AUDIO_TRACK_CHANGE |
audioTrackChange | string | The event has the detail field with the new track. |
ID3_METADATA |
id3Metadata | string | The event has the metadata field with the metadata info. |
FULLSCREEN_ENTER |
fullscreenEnter | string | |
FULLSCREEN_EXIT |
fullscreenExit | string | |
BACKGROUND_RECOVERY |
backgroundRecovery | string | Fired when the player recovers from a background state on a live stream
by seeking to the live edge minus the Config.playerConfig.safeSeekOffset property.
The event has the detail field with the number of seconds
the playhead was behind the live edge. |
STT_CONNECTED |
sttConnected | string | Fired when the STT WebSocket connects. detail: {language}. |
STT_DISCONNECTED |
sttDisconnected | string | Fired when the STT WebSocket closes. detail: {language}. |
STT_ERROR |
sttError | string | Fired on a fatal STT error (incl. reconnect exhaustion). detail: {reason, code}. |
STT_CUE |
sttCue | string | Fired when an STT caption is appended. detail: {key, rid, sentence, start, end, language}, where `key` is stable across revisions of the same caption and `rid` is not. |
(static, constant) PLAYER_STATES :string
The player states.
Properties:
| Name | Value | Type | Description |
|---|---|---|---|
NONE |
None | string | |
CONTENT_REQUESTED |
ContentRequested | string | |
READY |
Ready | string | |
BUFFERING |
Buffering | string | |
PLAYING |
Playing | string | |
PAUSED |
Paused | string | |
SEEK |
Seek | string | |
ENDED |
Ended | string |
(static, constant) SocialId :string
Properties:
| Name | Value | Type | Description |
|---|---|---|---|
FACEBOOK |
string | ||
X |
x | string | |
REDDIT |
string | ||
LINKEDIN |
string | ||
TUMBLR |
tumblr | string | |
TELEGRAM |
telegram | string | |
WHATSAPP |
string | ||
PINTEREST |
string | ||
DIRECT_LINK |
directLink | string | |
CUSTOM |
custom | string | |
EMBED |
embed | string |
(static, constant) StreamingProtocol :string
HISPlayer protocols.
Properties:
| Name | Value | Type | Description |
|---|---|---|---|
NONE |
None | string | |
DASH |
DASH | string | |
HLS |
HLS | string | |
MSS |
MSS | string | |
PROGRESSIVE_DOWNLOAD |
Progressive download | string | |
UNKNOWN |
Unknown | string |
Methods
addEventListener(type, listener)
Add an event listener to this object.
Parameters:
| Name | Type | Description |
|---|---|---|
type |
string | The event type to listen for. |
listener |
EventListener | function | The callback or listener object to invoke. |
changeWatermarkStrength(value)
Modifies the watermark's strength. Currently, this method is only
supported for Verimatrix Watermarking.
Parameters:
| Name | Type | Description |
|---|---|---|
value |
number | Posible values are 255 (visible and testing only) and 1-100 (production). |
(async) destroy()
Destroy the player's instance.
disableABR()
Disables the ABR to prevent the player from changing tracks regardless of bandwidth.
enableABR()
Enables the ABR to change automatically between tracks.
getAdManager() → (nullable) {AdManager}
Returns the current AdManager.
getAssetUri() → {string|null}
Returns the URI of the currently loaded manifest, or
null if no
source has been loaded.
getAudios() → (nullable) {Array.<AudioTrack>}
Returns the audio tracks of the current playback.
getAvailabilityStartTime() → (nullable) {number}
Return the availability start time in seconds for live streams.
getBandwidthEstimate() → {number}
Returns the current estimated bandwidth (in bit/sec).
getChapters(language) → (nullable) {Array.<Chapter>}
Returns the chapters of the current playback.
Parameters:
| Name | Type | Description |
|---|---|---|
language |
string |
getChromecastSender() → (nullable) {ChromecastSender}
Returns the current Chromecast Sender controller.
getCurrentAudio() → (nullable) {AudioTrack}
Returns the current audio track of the current playback.
getCurrentContentType() → (nullable) {string}
Returns the current content type.
getCurrentHeight() → {number}
Returns the current height of the track displayed.
getCurrentSegmentContainer() → (nullable) {object}
Returns the current segment container for the current playback.
getCurrentSubtitle() → (nullable) {SubtitleTrack}
Returns the subtitle audio track of the current playback.
getCurrentTime() → {number}
Returns the playback's current time.
getCurrentTrack() → (nullable) {Track}
Returns the current track of the current playback.
getCurrentWidth() → {number}
Returns the current width of the track displayed.
getDroppedFrames() → {number}
Returns the number of the droppedFrames for the current playback.
getDuration() → {number}
Returns the duration of the stream.
getManifestUrl() → (nullable) {string}
Gets the manifest's URL of the stream loaded.
getMediaElement() → {HTMLMediaElement}
Returns the media element.
getPlaybackRate() → {number}
Returns the current playback rate.
getPlayerContainerDiv() → {Element}
Returns the div Element where the player is displayed.
getPlayheadTimeAsEpoch() → {number|null}
Get the playhead time as a epoch time (in seconds since 1970).
getProgramDateTimeEpoch() → {number|null}
Get the epoch time (in seconds since 1970) of the first EXT-X-PROGRAM-DATE-TIME tag.
Only available for HLS manifests.
getProgramDateTimeString() → {string|null}
Get the EXT-X-PROGRAM-DATE-TIME value seen in the manifest.
Only available for HLS manifests.
getProtocol() → (nullable) {StreamingProtocol}
Returns the current protocol.
getPublishTime() → (nullable) {number}
Return the publish time in seconds for live streams.
getStats() → {HisPlayerStats}
Returns player stats including segment download times, buffer info and various playback related statistics.
getSttBaseFontSize() → {number}
The STT caption font size as configured at init time: the plain-pixel value of
kollusSTTSubtitles.style.fontSize if it parses as one, else the
stylesheet default (20px). Unlike getSttFontSize, never reflects a
runtime override — this is the fixed "1.0x" reference point the size slider
scales from.
getSttFontSize() → {number}
The STT caption font size currently in effect: the runtime override set via
setSttFontSize if any, else getSttBaseFontSize.
getSttLanguage() → (nullable) {string}
The active STT caption language — the one captions are actually being
received in. Mirrors the source's default (config.language falling back to
supportedLanguages[0]) before a source exists, so a language picker can be
seeded to the real active language rather than assuming supportedLanguages[0].
getSttLanguages() → {Array.<string>}
The selectable STT language codes: the configured
supportedLanguages
plus the always-available original ("as-spoken") track. Safe to call before
playback starts so a language picker can be built ahead of the first caption.
Returns [] when STT is not configured at all — neither a language list
nor a detected channel/broadcast key. The subtitle button treats a non-empty result
as "this stream has captions", so 'original' must not be offered unconditionally.
getSttOriginalLabel() → {string}
The subtitle-menu label for the original ("as-spoken") STT track.
getSttSubtitleStyleOptions() → {{showToggleBackground: boolean, showSizeSlider: boolean}}
Which optional STT caption UI controls to show, per
kollusSTTSubtitles.style.showToggleBackground / showSizeSlider.
getSubtitles() → (nullable) {Array.<SubtitleTrack>}
Returns the subtile tracks of the current playback.
getThumbnailAt(time) → {Promise.<Thumbnail>}
Returns the thumbnail of certain time of the current playback.
Parameters:
| Name | Type | Description |
|---|---|---|
time |
number |
getTimeShiftBufferDepth() → (nullable) {number}
Gets the time shift buffer depth for live streams.
getTracks() → (nullable) {Array.<Track>}
Returns the tracks of the current playback.
getUiManager() → (nullable) {UIManager}
Returns the current UIManager.
getVRManager() → (nullable) {VRManager}
Returns the current VRManager.
getVolume() → {number}
Returns the current volume. Valid values are contained between 0.0 and 1.0.
(async) init(userConfig)
Initializate the playback and the player controllers
Parameters:
| Name | Type | Description |
|---|---|---|
userConfig |
Config |
Throws:
Will throw an error if the platform is not supported or if mandatory parameters are missing.
isLive() → {boolean}
Returns true if the current stream is a live stream.
isMuted() → {boolean}
Returns true if the current playback is muted.
isPaused() → (nullable) {boolean}
Returns true if the video is paused.
isPlayingAd() → {boolean}
Returns true if an ad is playing.
isSeeking() → {boolean}
Returns true if the current playback is seeking.
isSttActive() → {boolean}
Whether Kollus STT captions are currently active (source started and not
stopped). Used by the subtitle menu to highlight the active STT language
and to keep classic-vs-STT selection mutually exclusive.
isSttBackgroundVisible() → {boolean}
Whether the STT caption background is currently shown. Defaults to true;
toggled at runtime by setSttBackgroundVisible, independently of the
kollusSTTSubtitles.style.backgroundColor configured at init time.
listenToAllEvents(listener)
Add an event listener to this object that is invoked for all events types the object fires.
Parameters:
| Name | Type | Description |
|---|---|---|
listener |
EventListener | function | The callback or listener object to invoke. |
(async) loadSource(url, resumePositionopt, externalSubtitlesopt, staticThumbnailsVTTopt, externalChaptersopt, adsopt, requestLoaderopt, responseLoaderopt)
Parameters:
| Name | Type | Attributes | Default | Description | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
url |
string | URL of the new stream to be loaded. | ||||||||||||||||||||||||||||||
resumePosition |
number |
<optional> |
Determines the position in seconds where the video will start playing. | |||||||||||||||||||||||||||||
externalSubtitles |
Array.<object> |
<optional> |
[] | Used to provide subtitle files as external subtitles.
Properties
|
||||||||||||||||||||||||||||
staticThumbnailsVTT |
string |
<optional> |
||||||||||||||||||||||||||||||
externalChapters |
Array.<object> |
<optional> |
[] | Used to provide the player an external chapters.
Properties
|
||||||||||||||||||||||||||||
ads |
Ads |
<optional> |
Ad configuration | |||||||||||||||||||||||||||||
requestLoader |
RequestLoader |
<optional> |
Custom request loader. Replaces any previous request loader configured via init() or a prior loadSource() call. | |||||||||||||||||||||||||||||
responseLoader |
ResponseLoader |
<optional> |
Custom response loader. Replaces any previous response loader configured via init() or a prior loadSource() call. |
pause()
Pause the current stream.
(async) play()
Play the current stream if it is loaded and paused.
removeEventListener(type, listener)
Remove an event listener from this object.
Parameters:
| Name | Type | Description |
|---|---|---|
type |
string | The event type for which you wish to remove a listener. |
listener |
EventListener | function | The callback or listener object to remove. |
seek(timePosition)
Seek the playhead to the position provided.
Parameters:
| Name | Type | Description |
|---|---|---|
timePosition |
number |
seekLive()
Seek to the live position in a live stream.
seekRange() → (nullable) {object}
Returns the seek range of the current stream.
setAudio(track)
Set the current audio track of the playback.
Parameters:
| Name | Type | Description |
|---|---|---|
track |
AudioTrack |
setMaxAbrResolution(width, height)
Set the max ABR resolution.
Parameters:
| Name | Type | Description |
|---|---|---|
width |
number | |
height |
number |
setMinAbrResolution(width, height)
Set the min ABR resolution.
Parameters:
| Name | Type | Description |
|---|---|---|
width |
number | |
height |
number |
setMute(muted)
Set the mute for the current playback.
Parameters:
| Name | Type | Description |
|---|---|---|
muted |
boolean |
setSttBackgroundVisible(visible)
Toggle the STT caption background on/off at runtime. Applies immediately to
every caption currently on screen, and persists across STT reconnects.
Parameters:
| Name | Type | Description |
|---|---|---|
visible |
boolean |
setSttFontSize(size)
Adjust the STT caption font size at runtime. Applies immediately to every
caption currently on screen, and persists across STT reconnects, independently
of
kollusSTTSubtitles.style.fontSize configured at init time.
Parameters:
| Name | Type | Description |
|---|---|---|
size |
number | string | Font size in pixels, or any CSS length (e.g. '1.4vmin'). |
setSttLanguage(code)
Switch the active STT caption language (reconnects). Rejects unsupported codes.
Parameters:
| Name | Type | Description |
|---|---|---|
code |
string |
setSubtitle(track)
Set the current subtitle track of the playback.
Parameters:
| Name | Type | Description |
|---|---|---|
track |
SubtitleTrack |
setTrack(trackopt, clearBufferopt)
Set the current track of the playback.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
track |
Track |
<optional> |
If not track provider, enable ABR. | |
clearBuffer |
boolean |
<optional> |
true |
setTrickPlay(rate)
Enable trick play to skip through content without playing by repeatedly seeking.
For example, a rate of 2.5 would result in 2.5 seconds of content being skipped
every second. A negative rate will result in moving backwards.
Parameters:
| Name | Type | Description |
|---|---|---|
rate |
number |
setVolume(volume)
Set the volume for the current playback.
Parameters:
| Name | Type | Description |
|---|---|---|
volume |
number | The volume to set, from 0 (muted) to 1 (loudest). |
setWatermarkTransactionId(value)
Change the ID required for initializing the Verimatrix Watermarking. Currently, this method is only
supported for Verimatrix Watermarking.
Parameters:
| Name | Type | Description |
|---|---|---|
value |
number | Posible values are 0-687194767365. |
startSttSubtitles(optionsopt)
Start receiving real-time STT subtitles over WebSocket.
Merges the optional overrides onto Config.kollusSTTSubtitles. Live streams only.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
options |
object |
<optional> |
Partial kollusSTTSubtitles overrides (env, channelKey, broadcastKey, language, ...). |
stopSttSubtitles()
Stop STT subtitles and close the WebSocket.
(async) toggleFullscreen() → {Promise.<void>}
Toggles the fullscreen state.
(static) getVersion() → {string}
Returns the player version.