Members
-
<constant> $
-
Finds a single DOM element matching
selector
within the optional
context
of another DOM element (defaulting todocument
). -
<constant> $$
-
Finds a all DOM elements matching
selector
within the optional
context
of another DOM element (defaulting todocument
). -
<constant> bind
-
Bind (a.k.a proxy or Context). A simple method for changing the context of a function
It also stores a unique id on the function so it can be easily removed from events. -
<constant> EmpPlayerErrorCodes
-
EmpPlayerErrorCodes - Holds all available error codes
-
<constant> findMimetype
-
Find the mime type of a given source string if possible. Uses the player
source cache. -
<constant> getMimetype
-
Get the mimetype of a given src url if possible
-
<constant> IS_UWP
-
It it running on Universal Windows Platform (UWP) Windows Store App or xBox
-
<constant> isoLangs
-
-
<constant> KeyCodeMapGamePad
-
Key Code Mapping for GamePad
-
<constant> throttle
-
Wraps the given function,
fn
, with a new function that only invokesfn
at most once per everywait
milliseconds.
Methods
-
activateTrack()
-
activateTrack
-
AdBreakEnd()
-
AdBreakEnd
-
AdBreakStart()
-
AdBreakStart
-
addClass(element, classToAdd)
-
Add a CSS class name to an element
Parameters:
Name Type Description element
Element Element to add class name to.
classToAdd
string Class name to add.
Returns:
The dom element with the added class name.
- Type
- Element
-
AdvertEnd()
-
AdvertEnd
-
AdvertStart()
-
AdvertStart
-
appendContent(el, content)
-
Normalizes and appends content to an element.
Parameters:
Name Type Description el
Element Element to append normalized content to.
content
string | Element | TextNode | Array | function See the
content
argument of dom:normalizeContentReturns:
The element with appended normalized content.
- Type
- Element
-
arrayToString(array)
-
arrayToString
Parameters:
Name Type Description array
Array array
Returns:
String
- Type
- string
-
base64DecodeUint8Array(input)
-
base64DecodeUint8Array
Parameters:
Name Type Description input
string input
Returns:
Uint8Array
- Type
- Uint8Array
-
base64EncodeUint8Array(input)
-
base64EncodeUint8Array
Parameters:
Name Type Description input
Array input
Returns:
base64
- Type
- string
-
blockTextSelection()
-
Attempt to block the ability to select text while dragging controls
-
canChangeFullScreen(newState)
-
Determine whether the player is allowed to change full screen to the specified full screen
state.Parameters:
Name Type Description newState
boolean New fullscreen state requested (
true
to enter fullscreen,
false
to leave fullscreen)Returns:
true
if the player is allowed to make the fullscreen state transition
requested- Type
- boolean
-
canClickThrough()
-
Determine whether the viewer is allowed to click-through on the currently displayed creative
Returns:
true
if a clickthrough is permitted on the current creative,
otherwisefalse
- Type
- boolean
-
canExpandCreative()
-
Determine whether the currently displayed non-linear creative may be expanded
Returns:
true
if the non-linear may be expanded, otherwisefalse
- Type
- boolean
-
canMute()
-
Determine whether the player is allowed to mute the audio playback
Returns:
true
if audio playback may be muted, otherwisefalse
- Type
- boolean
-
canPause()
-
Determine whether the player is allowed to pause video playback
Returns:
true
if playback may be paused, otherwisefalse
- Type
- boolean
-
canPlayEncrypted()
-
Detects if the current browser has the required technology to play an encrypted stream provided by EMP.
Returns:
that is always fulfilled with a boolean value
- Type
- Promise
-
canPlayUnencrypted()
-
Detects if the current browser has the required technology to play an unencrypted stream provided by EMP.
Returns:
that is always fulfilled with a boolean value
- Type
- Promise
-
canSeek()
-
Determine whether the player is allowed to seek from the current playhead position
Returns:
true
if seek is permitted, otherwisefalse
- Type
- boolean
-
canSeekTo(offset)
-
Determine whether the player is permitted to seek to a permitted point in the stream.
Based on the provided location, the nearest permissible location is returned which should
be used by the player to override the viewers chosen seek location. This is to enable the
ability to prevent skipping over adverts.Parameters:
Name Type Description offset
number Desired seek position (stream position in seconds)
Returns:
"Best" stream position in seconds where seek is permitted
- Type
- number
-
canSkip()
-
Determine whether the player is allowed to skip the current advert
Returns:
0+
if skip is permitted (the value is the delay in seconds
before skip is permitted, otherwise-1
which means the advert is not skippable- Type
- number
-
canStart()
-
Determine whether the player is allowed to start video playback
Returns:
true
if playback may be started, otherwisefalse
- Type
- boolean
-
canStop()
-
Determine whether the player is allowed to stop video playback
Returns:
true
if playback may be stopped, otherwisefalse
- Type
- boolean
-
classRegExp(className)
-
Produce a regular expression for matching a className within an elements className.
Parameters:
Name Type Description className
string The className to generate the RegExp for.
Returns:
The RegExp that will check for a specific
className
in an elements
className.- Type
- RegExp
-
constructor(player [, options])
-
Plugin class constructor, called by videojs on
ready event.Parameters:
Name Type Argument Default Description player
Player A Video.js player object.
options
Object <optional>
{} A plain object containing options for the plugin.
-
convertQueToSources(currentItemId, items)
-
convert Que To Sources
Parameters:
Name Type Description currentItemId
string items
Array Returns:
sources The sources for a media asset
- Type
- Array
-
createEl()
-
Create the component's DOM element
Returns:
The element that was created.
- Type
- Element
-
createEl()
-
Create the component's DOM element
Returns:
The element that was created.
- Type
- Element
-
createEl()
-
Create the component's DOM element
Returns:
The element that was created.
- Type
- Element
-
createEl()
-
Create the component's DOM element
Returns:
The element that was created.
- Type
- Element
-
createEl( [tagName] [, properties] [, attributes] [, content])
-
Creates an element and applies properties.
Parameters:
Name Type Argument Default Description tagName
string <optional>
'div' Name of tag to be created.
properties
Object <optional>
{} Element properties to be applied.
attributes
Object <optional>
{} Element attributes to be applied.
content
String | Element | TextNode | Array | function <optional>
Contents for the element (see: dom:normalizeContent)
Returns:
The element that was created.
- Type
- Element
-
createQuerier(method)
-
Creates functions to query the DOM using a given method.
Parameters:
Name Type Description method
string The method to create the query with.
Returns:
The query method
- Type
- function
-
debuggerInjector(debug)
-
debuggerInjector
Parameters:
Name Type Description debug
Object debug
-
<protected> Destroy()
-
Helper method used for shutting down the instance cleanly.
-
detectClient()
-
detectClient
Returns:
Client name and version
- Type
- Object
-
dispose()
-
dispose
-
emptyEl(el)
-
Empties the contents of an element.
Parameters:
Name Type Description el
Element The element to empty children from
Returns:
The element with no children
- Type
- Element
-
filterSource(src)
-
Filter out single bad source objects or multiple source objects in an
array. Also flattens nested source object arrays into a 1 dimensional
array of source objects.Parameters:
Name Type Description src
string src
Returns:
Sources
- Type
- Array
-
findPosition(el)
-
Offset Left.
getBoundingClientRect technique from
John ResigParameters:
Name Type Description el
Element Element from which to get offset
Returns:
The position of the element that was passed in.
- Type
- module:dom~Position
-
getAttribute(el, attribute)
-
Get the value of an element's attribute
Parameters:
Name Type Description el
Element A DOM element
attribute
string Attribute to get the value of
Returns:
value of the attribute
- Type
- string
-
getAttributes(tag)
-
Get an element's attribute values, as defined on the HTML tag
Attributes are not the same as properties. They're defined on the tag
or with setAttribute (which shouldn't be used with HTML)
This will return true or false for boolean attributes.Parameters:
Name Type Description tag
Element Element from which to get tag attributes.
Returns:
All attributes of the element.
- Type
- Object
-
getBaseUrl(url)
-
getBaseUrl from Url
Parameters:
Name Type Description url
string url
Returns:
BaseUrl
- Type
- string
-
getBoundingClientRect(el)
-
Identical to the native
getBoundingClientRect
function, but ensures that
the method is supported at all (it is in all browsers we claim to support)
and that the element is in the DOM before continuing.This wrapper function also shims properties which are not provided by some
older browsers (namely, IE8).Additionally, some browsers do not support adding properties to a
ClientRect
/DOMRect
object; so, we shallow-copy it with the standard
properties (exceptx
andy
which are not widely supported). This helps
avoid implementations where keys are non-enumerable.Parameters:
Name Type Description el
Element Element whose
ClientRect
we want to calculate.Returns:
Always returns a plain
- Type
- Object | undefined
-
getFileNameFromUrl(url)
-
get file name from Url
Parameters:
Name Type Description url
string url
Returns:
FileName
- Type
- string
-
getHostnameFromURI(uri)
-
get Host name From URI
Parameters:
Name Type Description uri
string uri
Returns:
Hostname
- Type
- string
-
getLanguageName(value)
-
get Language Name
Parameters:
Name Type Description value
string Language code
Returns:
Language Name
- Type
- string
-
getLanguageNativeName(value)
-
get Language Native Name
Parameters:
Name Type Description value
string Language code
Returns:
Language Native Name
- Type
- string
-
getMetadataTrack()
-
getMetadataTrack
Returns:
MetadataTrack
- Type
- track
-
getParameterByName(name, url)
-
get Parameter in url by name
Parameters:
Name Type Description name
string name
url
string url
Returns:
Parameter
- Type
- string
-
getPointerPosition(el, event)
-
Get pointer position in element
Returns an object with x and y coordinates.
The base on the coordinates are the bottom left of the element.Parameters:
Name Type Description el
Element Element on which to get the pointer position on
event
EventTarget~Event Event object
Returns:
A Coordinates object corresponding to the mouse position.
- Type
- Dom~Coordinates
-
guid()
-
Creates GUID for user based on several different browser variables
It will never be RFC4122 compliant but it is robustReturns:
GUID
- Type
- number
-
handleClick()
-
Handle click on mute
-
handleSource(source, tech)
-
Handle source
Source handler for dash playback.
Parameters:
Name Type Description source
Object Source object for playback
tech
Chromecast The instance of the Chromecast tech
-
hasClass(element, classToCheck)
-
Check if an element has a CSS class
Parameters:
Name Type Description element
Element Element to check
classToCheck
string Class name to check for
Throws:
-
Throws an error if
classToCheck
has white space. - Type
- Error
Returns:
- True if the element had the class
- False otherwise.
- Type
- boolean
-
-
hashCode(str)
-
get hashCode
Parameters:
Name Type Description str
string Returns:
the hashCode
- Type
- string
-
imageSelector(images, imageType)
-
Select the image to display for the asset
Parameters:
Name Type Description images
Array image objects
imageType
string image type in backend
Returns:
image object
- Type
- image
-
insertContent(el, content)
-
Normalizes and inserts content into an element; this is identical to
appendContent()
, except it empties the element first.Parameters:
Name Type Description el
Element Element to insert normalized content into.
content
string | Element | TextNode | Array | function See the
content
argument of dom:normalizeContentReturns:
The element with inserted normalized content.
- Type
- Element
-
isEl(value)
-
Determines, via duck typing, whether or not a value is a DOM element.
Parameters:
Name Type Description value
Mixed The thing to check
Returns:
- True if it is a DOM element
- False otherwise
- Type
- boolean
- True if it is a DOM element
-
isInFrame()
-
Determines if the current DOM is embedded in an iframe.
Returns:
DOM is embedded in an iframe
- Type
- boolean
-
isNonBlankString(str)
-
Detect if a value is a string with any non-whitespace characters.
Parameters:
Name Type Description str
string The string to check
Returns:
- True if the string is non-blank
- False otherwise
- Type
- boolean
- True if the string is non-blank
-
ISO639Converter()
-
ISO639Converter
-
isPromise(value)
-
Returns whether an object is
Promise
-like (i.e. has athen
method).Parameters:
Name Type Description value
Object An object that may or may not be
Promise
-like.Returns:
Whether or not the object is
Promise
-like.- Type
- boolean
-
isReal()
-
Whether the current DOM interface appears to be real.
Returns:
DOM interface appears to be real.
- Type
- boolean
-
isString(val)
-
check if type is string
Parameters:
Name Type Description val
Object val
Returns:
isString
- Type
- boolean
-
isTextNode(value)
-
Determines, via duck typing, whether or not a value is a text node.
Parameters:
Name Type Description value
Mixed Check if this value is a text node.
Returns:
- True if it is a text node
- False otherwise
- Type
- boolean
- True if it is a text node
-
log()
-
Log plain debug messages
-
newGUID()
-
Get the next unique ID
Returns:
a GUID
- Type
- string
-
normalizeContent(content)
-
Normalizes content for eventual insertion into the DOM.
This allows a wide range of content definition methods, but protects
from falling into the trap of simply writing toinnerHTML
, which is
an XSS concern.The content for an element can be passed in multiple types and
combinations, whose behavior is as follows:Parameters:
Name Type Description content
string | Element | TextNode | Array | function - String: Normalized into a text node.
- Element/TextNode: Passed through.
- Array: A one-dimensional array of strings, elements, nodes, or functions
(which return single strings, elements, or nodes).
- Function: If the sole argument, is expected to produce a string, element,
node, or array as defined above.
Returns:
All of the content that was passed in normalized.
- Type
- Array
- String: Normalized into a text node.
-
oncuechange()
-
oncuechange
-
onEnded()
-
onEnded
-
onError()
-
onError
-
onFullscreenChange()
-
onFullscreenChange
-
onLoaded()
-
onLoaded
-
onPause()
-
onPause
-
onPlayAbort()
-
onPlayAbort
-
onPlaying()
-
onPlaying
-
onSeeked()
-
onSeeked
-
onSeeking()
-
onSeeking
-
onTimeUpdate()
-
onTimeUpdate
-
ontrackChange()
-
ontrackChange
-
onvolumeChange()
-
onvolumeChange
-
parseSrc(src)
-
parse a video source
Parameters:
Name Type Description src
string src
Returns:
asset
- Type
- Object
-
prependTo(child, parent)
-
Insert an element as the first child node of another
Parameters:
Name Type Description child
Element Element to insert
parent
Element Element to insert child into
-
removeAttribute(el, attribute)
-
Remove an element's attribute
Parameters:
Name Type Description el
Element A DOM element
attribute
string Attribute to remove
-
removeClass(element, classToRemove)
-
Remove a CSS class name from an element
Parameters:
Name Type Description element
Element Element to remove a class name from.
classToRemove
string Class name to remove
Returns:
The dom element with class name removed.
- Type
- Element
-
roundUp(value, decimals)
-
round up
Parameters:
Name Type Description value
number decimals
number Returns:
up rounded result
- Type
- number
-
setAttribute(el, attribute, value)
-
Set the value of an element's attribute
Parameters:
Name Type Description el
Element A DOM element
attribute
string Attribute to set
value
string Value to set the attribute to
-
setAttributes(el [, attributes])
-
Apply attributes to an HTML element.
Parameters:
Name Type Argument Description el
Element Element to add attributes to.
attributes
Object <optional>
Attributes to be applied.
-
setCurrentTime(time)
-
Set current time
Parameters:
Name Type Description time
number Current time of video
-
setSrc( [src])
-
Set video
Parameters:
Name Type Argument Description src
Object <optional>
Source object
-
setup(sessMgr)
-
setup
Parameters:
Name Type Description sessMgr
Object session manger
-
silencePromise(value)
-
Silence a Promise-like object.
This is useful for avoiding non-harmful, but potentially confusing "uncaught
play promise" rejection error messages.Parameters:
Name Type Description value
Object An object that may or may not be
Promise
-like. -
stringToArray(string)
-
stringToArray
Parameters:
Name Type Description string
string string
Returns:
Uint16Array
- Type
- Uint16Array
-
textContent(el, text)
-
Injects text into an element, replacing any existing contents entirely.
Parameters:
Name Type Description el
Element The element to add text content into
text
string The text content to add.
Returns:
The element with added text content.
- Type
- Element
-
throwIfWhitespace(str)
-
Throws an error if the passed string has whitespace. This is used by
class methods to be relatively consistent with the classList API.Parameters:
Name Type Description str
string The string to check for whitespace.
Throws:
-
Throws an error if there is whitespace in the string.
- Type
- Error
-
-
toggleClass(element, classToToggle [, predicate])
-
Adds or removes a CSS class name on an element depending on an optional
condition or the presence/absence of the class name.Parameters:
Name Type Argument Description element
Element The element to toggle a class name on.
classToToggle
string The class that should be toggled
predicate
boolean | PredicateCallback <optional>
See the return value for Dom~PredicateCallback
Returns:
The element with a class that has been toggled.
- Type
- Element
-
unblockTextSelection()
-
Turn off text selection blocking
-
updateContent()
-
Update time display
-
UpdateTimeline(timeline)
-
UpdateTimeline
Parameters:
Name Type Description timeline
Object timeline
-
ySPlayerPolicyInjector(ySPlayerPolicy)
-
Youspace Player Policy Injector
Parameters:
Name Type Description ySPlayerPolicy
Object PlayerPolicy
Events
-
ABORT
-
Fired when playback is aborted
-
ADD_TRACK
-
Fired when an AudioTrack object has been added to an AudioTrackList object.
-
BEFORE_MODAL_CLOSE
-
Used when a modal html view will be closed. Fired by VideoJS on the ModalDialog
-
BEFORE_MODAL_EMPTY
-
Used when a modal html view will clear its content. Fired by VideoJS on the ModalDialog
-
BEFORE_MODAL_FILL
-
Used when a modal html view will be populated with html content. Fired by VideoJS on the ModalDialog
-
BEFORE_MODAL_OPEN
-
Used when a modal html view is about to be opened. Fired by VideoJS on the ModalDialog
-
BITRATE_CHANGED
-
Fired when the video bitrate changes
-
BLUR
-
Used when an html element loses focus. Fired by VideoJS on components
-
CAN_PLAY
-
Fired when the player can start playback
-
CAN_PLAY_THROUGH
-
Enough data has been loaded to play the media up to its end
-
CHANGE
-
Fired when a state changes. Used for example when an AudioTrack changes its enabled value
-
CLICK
-
Used when an html element is clicked. Fired by VideoJS on components
-
CLOSE
-
Used when something closes. Fired by VideoJS when the CloseButton closes
-
CONTROLS_DISABLED
-
When controls are disabled
-
CONTROLS_ENABLED
-
When controls are enabled
-
DISPOSE
-
Fired when the player is destroyed.
-
DURATION_CHANGE
-
Fired when the video duration changes
-
EMPTIED
-
When the current playlist is empty
-
ENDED
-
Fired when video playback ends
-
ENTER_FULL_WINDOW
-
When fullscreen isn't supported and the video will resize to the window
-
ERROR
-
Fired when an error occurs
-
EXIT_FULL_WINDOW
-
When exiting full window
-
FIRST_PLAY
-
Video is played for the first time
-
FOCUS
-
Used when an html element gains focus. Fired by VideoJS on components
-
FULLSCREEN_CHANGE
-
When the fullscreen state changes
-
KEY_DOWN
-
When a key is down
-
KEY_UP
-
When a key is up
-
LOAD_START
-
Fired when the video is starting to load
-
LOADED_DATA
-
Fired when the player has downloaded data at the current playback position
-
LOADED_METADATA
-
Fired when the player has initial duration and dimension information
-
METRIC_CHANGED
-
Fired by Dash.js when a metric changes
-
MODAL_CLOSE
-
Used when a modal html view has been closed. Fired by VideoJS on the ModalDialog
-
MODAL_EMPTY
-
Used when a modal html view has cleared its content. Fired by VideoJS on the ModalDialog
-
MODAL_FILL
-
Used when a modal html view has been populated with html content. Fired by VideoJS on the ModalDialog
-
MODAL_OPEN
-
Used when a modal html view has been opened. Fired by VideoJS on the ModalDialog
-
MODE_CHANGE
-
Fired when an AudioTrack object changes its enabled value
-
MOUSE_DOWN
-
When the mouse is down
-
MOUSE_MOVE
-
When the mouse is moved
-
MOUSE_UP
-
When the mouse is up
-
PAUSE
-
Fired when the player is paused
-
PLAY
-
Fired when the player will start playing
-
PLAYING
-
Fired when the player has starting playback
-
POSTER_CHANGE
-
When the video poster changes
-
PROGRESS
-
When the user agent is downloading media data
-
RATE_CHANGE
-
When the playing speed of the audio/video is changed
-
READY
-
Used when something is ready. Fired when the tech is ready
-
RECOVERABLE_ASSET_ERROR
-
Fired when a recoverable asset error occurs
-
REMOVE_TRACK
-
Fired when an AudioTrack object has been removed from an AudioTrackList object.
-
RESIZE
-
Used when an html element resizes. Fired when the video element changes size
-
SEEKED
-
Fired when the player seeked to a different point in time
-
SEEKING
-
Fired when the player started seeking
-
SLIDER_ACTIVE
-
Fired when a VideoJS slider is active
-
SLIDER_INACTIVE
-
Fired when a VideoJS slider is inactive
-
STALLED
-
When the player is trying to get media data, but data is not available
-
SUSPEND
-
When the player is suspended from downloading media data
-
TAP
-
Used when an html element is tapped. Fired by VideoJS on components
-
TEXT_TRACK_CHANGE
-
When the text track has been changed
-
TIME_UPDATE
-
Fired when the current playback position has changed
-
TIMESHIFT_CHANGE
-
Fired when the timeshift changes
-
TOUCH_CANCEL
-
When a touch point has been disrupted
-
TOUCH_END
-
When touch ended
-
TOUCH_LEAVE
-
When a touch point is moved off the interactive area of an element
-
TOUCH_MOVE
-
When touch moved
-
TOUCH_START
-
When touch started
-
TRACK_CHANGE
-
When the track has been changed
-
USER_ACTIVE
-
Fired when the user is active
-
USERIN_ACTIVE
-
Fired when the user is inactive
-
USING_CUSTOM_CONTROLS
-
When custom controls are being used
-
USING_NATIVE_CONTROLS
-
When native tech or device controls are being used
-
VOLUME_CHANGE
-
Fired when the volume changes
-
WAITING
-
Fired when the player starts buffering