API reference
Overview
This is the API reference which presents every RxPlayer API in a single page.
The point of this page is to provide an easier-to-navigate page than the API documentation for when you’re already familiar with it.
API are splitted here in multiple categories depending on if they are properties, methods, events and so on.
Constructor
new RxPlayer()
: Create a new RxPlayer.
Constructor options
-
videoElement
: specifies the media element on which the content will play. -
baseBandwidth
: Base value for the bandwidth calculated by the RxPlayer. -
wantedBufferAhead
: Set the default buffering goal. -
maxBufferAhead
: Set the default maximum kept buffer ahead of the current position, in seconds. -
maxBufferBehind
: Set the default maximum kept buffer before the current position, in seconds. -
maxVideoBufferSize
: Set the default maximum size the video buffer can take in the memory, in kilobytes (kb). -
videoResolutionLimit
: Limit the maximum video resolution according to the element’s or screen’s resolution. -
throttleVideoBitrateWhenHidden
: Limit the maximum video bitrate when the current video is hidden to the user.
loadVideo
options
-
transport
: The adaptive streaming technology (e.g. “dash”, “smooth” etc.) used. -
url
: URL to the content (e.g. DASH’s MPD, Smooth’s Manifest etc.) -
keySystems
: DRM configuration for the content.-
keySystems[].type
: Name of the DRM technology wanted. -
keySystems[].getLicense
: Logic to fetch the license. -
keySystems[].getLicenseConfig
: Supplementary configuration linked to thegetLicense
function. -
keySystems[].serverCertificate
: Eventual certificate encrypting exchanges between the CDM and license server. -
keySystems[].persistentLicenseConfig
: Allows to ask for the DRM session to persist the license. -
keySystems[].onKeyExpiration
: Behavior when a key has an"internal-error"
status. -
keySystems[].onKeyOutputRestricted
: Behavior when a key has an"output-restricted"
status. -
keySystems[].onKeyInternalError
: Behavior when a key has an"internal-error"
status. -
keySystems[].maxSessionCacheSize
: Maximum number of DRM sessions cached by the RxPlayer. -
keySystems[].closeSessionsOnStop
: Closes DRM sessions when the content stops. -
keySystems[].singleLicensePer
: Allows to use a singlegetLicense
call for keys linked to multiple qualities. -
keySystems[].disableMediaKeysAttachmentLock
: Disable a lock that may cause the RxPlayer to deadlock on encrypted contents on some peculiar devices. -
keySystems[].distinctiveIdentifier
: Allows the configuration of the Distinctive Indentifier(s) property. -
keySystems[].persistentState
: Allows the configuration of the persistentState property. -
keySystems[].audioCapabilitiesConfig
: Allows the configuration of theaudioCapabilities
property. -
keySystems[].videoCapabilitiesConfig
: Allows the configuration of thevideoCapabilities
property.
-
-
autoPlay
: Allows to automatically play after a content is loaded. -
startAt
: Define the position at which the RxPlayer should start. -
requestConfig
: Configuration linked to the Manifest and segment requests.-
requestConfig.segment.maxRetry
: Maximum number of retries when a segment request fails. -
requestConfig.segment.timeout
: Timeout after which segment requests are aborted. -
requestConfig.manifest.maxRetry
: Maximum number of retries when a Manifest request fails. -
requestConfig.manifest.timeout
: Timeout after which manifest requests are aborted.
-
-
textTrackMode
: The way in which the text tracks should be displayed. -
textTrackElement
:HTMLElement
in which text tracks should be displayed. -
minimumManifestUpdateInterval
: Allows to limit the frequency of Manifest updates. -
initialManifest
: Allows to provide an initial Manifest to speed-up the content loading -
representationFilter
: Filter out qualities from the Manifest based on its characteristics. -
segmentLoader
: Provide a custom logic to fetch segments. -
manifestLoader
: Provide a custom logic to fetch the Manifest. -
onCodecSwitch
: Behavior when the codec changes between incompatible ones. -
defaultAudioTrackSwitchingMode
: Default behavior when switching the audio track. -
lowLatencyMode
: Allows to play low-latency contents efficiently. -
enableFastSwitching
: Enable or disable an optimization replacing segments of poor quality with segments of a better quality. -
checkMediaSegmentIntegrity
: Enable supplementary checks to retry a request if a segment appears corrupted. -
serverSyncInfos
: Provide time synchronization mechanism between the client and server. -
referenceDateTime
: Default offset to add to the segment’s time to obtain a live time. This is in most cases not needed.
Methods
-
loadVideo
: Load a content. -
getPlayerState
: Get the current player’s state. -
addEventListener
: Add a listener to one of the RxPlayer’s event. -
removeEventListener
: Remove a listener to one of the RxPlayer’s event. -
play
: Resume paused content. -
pause
: Pause the current content. -
stop
: Stop playing the current content. -
getPosition
: Get the current playback condition. -
getWallClockTime
: Get the current playback condition offseted to be relative to the the current date. -
seekTo
: Seek in the current content. -
getMinimumPosition
: Get the minimum seekable position. -
getMaximumPosition
: Get the maximum seekable position. -
getMediaDuration
: Get the duration linked to the media element. -
getError
: Returns the current “fatal” error. -
getVideoElement
: Returns the media element linked to the RxPlayer. -
dispose
: Dispose of most resources taken by the RxPlayer. -
reload
: Reload the last loade content as fast as possible. -
getAvailablePeriods
: Returns the list of available Periods for the current content. -
getCurrentPeriod
: Returns information on the Period being currently played. -
getAudioTrack
: Get information on the current audio track. -
getTextTrack
: Get information on the current text track. -
getVideoTrack
: Get information on the current video track. -
getAvailableAudioTracks
: Get information on all the available audio tracks. -
getAvailableTextTracks
: Get information on all the available text tracks. -
getAvailableVideoTracks
: Get information on all the available video tracks. -
setAudioTrack
: Set the current audio track. -
setTextTrack
: Set the current text track. -
setVideoTrack
: Set the current video track. -
disableTextTrack
: Disable the current text track. -
disableVideoTrack
: Disable the current video track. -
getVideoRepresentation
: Returns the currently-loading video Representation. -
getAudioRepresentation
: Returns the currently-loading audio Representation. -
lockVideoRepresentations
: Select video Representations (a.k.a. qualities) that should the only one being played. -
lockAudioRepresentations
: Select audio Representations (a.k.a. qualities) that should the only one being played. -
unlockVideoRepresentations
: Disable a lock previously set withlockVideoRepresentations
. -
unlockAudioRepresentations
: Disable a lock previously set withlockAudioRepresentations
. -
getLockedVideoRepresentations
: Get the list of currently “locked” video Representations (a.k.a. qualities). -
getLockedAudioRepresentations
: Get the list of currently “locked” audio Representations (a.k.a. qualities). -
unlockVideoRepresentations
: Deactivate potential pending video Representations (a.k.a. qualities) lock, thus re-allowing any Representation to being played. -
unlockAudioRepresentations
: Deactivate potential pending audio Representations (a.k.a. qualities) lock, thus re-allowing any Representation to being played. -
isTrickModeEnabled
: Returnstrue
if trick mode tracks are currently enabled by default. -
setPlaybackRate
: Update the speed at which the content is played. -
getPlaybackRate
: Read the speed at which the content is played. -
areTrickModeTracksEnabled
: Indicates if the tricmode tracks are active by default. -
setVolume
: Update the audio volume. -
getVolume
: Get the current audio volume. -
mute
: Mute the audio volume. -
isMute
: Returntrue
if the audio volume is set to0
. -
unMute
: Restore the volume as it was before it was muted. -
setWantedBufferAhead
: Update the buffering goal, in seconds. -
getWantedBufferAhead
: Get the current buffering goal, in seconds -
setMaxBufferBehind
: Remove automatically old media data. -
getMaxBufferBehind
: Get the current maximum kept buffer behind the current position, in seconds. -
setMaxBufferAhead
: Remove automatically media data too far ahead. -
getMaxBufferAhead
: Get the current maximum kept buffer ahead of the current position, in seconds. -
setMaxVideoBufferSize
: Set the maximum memory the video buffer can take up in the memory, in kilobytes. -
getMaxVideoBufferSize
: Get the maximum memory the video buffer can take up in the memory, in kilobytes. -
updateContentUrls
: Update URL(s) of the content currently being played. -
isLive
: Returnstrue
if the content is a “live” content. -
getKeySystemConfiguration
: Returns information on the key system currently attached to the HTMLMediaElement linked to the RxPlayer. -
getCurrentBufferGap
: Returns in seconds the difference between the current position and the end of the current media time range. -
getContentUrls
: Get URLs of the currently-played content. -
isBuffering
: Returnstrue
if the player is buffering. -
isPaused
: Returnstrue
if the<video>
element is paused. -
getLastStoredContentPosition
: Returns the last stored content position, in seconds.
Static Properties
-
version
: The current version of the RxPlayer. -
LogLevel
: Update the verbosity of the RxPlayer logger. -
ErrorTypes
: All Error types that can be encountered. -
ErrorCodes
: All Error codes that can be encountered.
Events
-
playerStateChange
: The current state of the player has changed. -
error
: A fatal error happened. -
warning
: A non-fatal error happened. -
positionUpdate
: Regular event about the current position evolving. -
seeking
: A seek operation began. -
seeked
: A seek operation ended. -
availableAudioTracksChange
: The list of available audio tracks changed. -
availableVideoTracksChange
: The list of available video tracks changed. -
availableTextTracksChange
: The list of available text tracks changed. -
audioTrackChange
: The current audio track changed. -
videoTrackChange
: The current video track changed. -
textTrackChange
: The current text track changed. -
periodChange
: A new Period begins. -
newAvailablePeriods
: New Periods associated to the current content are known. It is also now possible to change their respective tracks and qualities. -
brokenRepresentationsLock
: Representations previously being locked was automatically unlocked by the RxPlayer. -
autoTrackSwitch
: A track previously set was automatically changed by the RxPlayer. -
inbandEvents
: Events in the media have been encountered. -
streamEvent
: A “stream event” just started. -
streamEventSkip
: A “stream event” was just skipped.
Error types
-
NETWORK_ERROR
: A network-related error. -
MEDIA_ERROR
: A media-related error. -
ENCRYPTED_MEDIA_ERROR
: An error related to media decryption. -
OTHER_ERROR
: Another non-categorized error.
Tools
-
TextTrackRenderer
: Render external text tracks on top of the video. -
VideoThumbnailLoader
: Display seeking preview thumbnails from trick mode video tracks. -
StringUtils
: Various string conversion utils. -
parseBifThumbnails
: Parse thumbnails in the “BIF” format. -
MediaCapabilitiesProber
: Tool to probe several media-related browser APIs. -
createMetaplaylist
: Generate a MetaPlaylist content.