Class: HisPlayer

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) BUFFER_TYPE :string

WebRTCPlayer 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.
BUFFER_TYPE bufferType string The event has the detail field with the BUFFER_TYPE.
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

(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 facebook string
X x string
REDDIT reddit string
LINKEDIN linkedin string
TUMBLR tumblr string
TELEGRAM telegram string
WHATSAPP whatsApp string
PINTEREST pinterest 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

(static) getVersion() → {string}

Returns the player version.

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.

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.

getProtocol() → (nullable) {StreamingProtocol}

Returns the current protocol.

getPublishTime() → (nullable) {number}

Return the publish time in seconds for live streams.

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.

getVolume() → {number}

Returns the current volume. Valid values are contained between 0.0 and 1.0.

getVRManager() → (nullable) {VRManager}

Returns the current VRManager.

(async) init(userConfig)

Initializate the playback and the player controllers
Parameters:
Name Type Description
userConfig Config

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.

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)

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
Name Type Description
src string Subtitles file URL.
language string Subtitle language identifier.
staticThumbnailsVTT string <optional>
externalChapters Array.<object> <optional>
[] Used to provide the player an external chapters.
Properties
Name Type Attributes Description
src string <optional>
Chapter file URL.
markers Array.<object> <optional>
Chapter markers.
Properties
Name Type Attributes Description
time number <optional>
Chapter time.
title string <optional>
Chapter title.
language string Chapter language identifier.
ads Ads <optional>
Ad configuration

pause()

Pause the current stream.

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

setMute(muted)

Set the mute for the current playback.
Parameters:
Name Type Description
muted boolean

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.

(async) toggleFullscreen() → {Promise.<void>}

Toggles the fullscreen state.