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 |
---|---|---|---|
LICENSE_ERROR |
licenseError | string | |
SUBTITLES_READY |
subtitlesReady | string | |
STATE_CHANGE |
stateChange | string | |
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 |
(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 | |
ENDED |
Ended | string |
(static, constant) StreamingProtocol :string
HisPlayer protocols.
Properties:
Name | Value | Type | Description |
---|---|---|---|
NONE |
None | string | |
DASH |
DASH | string | |
HLS |
HLS | 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. |
(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() → {AdManager}
Returns the current AdManager.
getAudios() → {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) → {Array.<Chapter>}
Returns the chapters of the current playback.
Parameters:
Name | Type | Description |
---|---|---|
language |
string |
getCurrentAudio() → (nullable) {AudioTrack}
Returns the current audio track of the current playback.
getCurrentContentType() → {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() → {StreamingProtocol}
Returns the current protocol.
getPublishTime() → (nullable) {number}
Return the publish time in seconds for live streams.
getSubtitles() → {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() → {Array.<Track>}
Returns the tracks of the current playback.
getUiManager() → {UIManager}
Returns the current UIManager.
getVolume() → {number}
Returns the current volume. Valid values are contained between 0.0 and 1.0.
getVRManager() → {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() → {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)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
url |
string | ||
resumePosition |
number |
<optional> |
|
externalSubtitles |
Array.<object> |
<optional> |
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() → {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 |
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). |