Members
-
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 innerHTMLDescriptorPolyfill
-
our implementation of an
innerHTMLdescriptor for browsers that do not have one. -
constant srcDescriptorPolyfill
-
our implementation of a
srcdescriptor for browsers that do not have one.
Methods
-
clamp(number, min, max) → {number}
-
Keep a number between a min and a max value
Parameters:
Name Type Description numbernumber The number to clamp
minnumber The minimum value
maxnumber The maximum value
Returns:
number -the clamped number
-
constructColor(color, opacity) → {string}
-
Construct an rgba color from a given hex color code.
Parameters:
Name Type Description colornumber Hex number for color, like #f0e or #f604e2.
opacitynumber Value for opacity, 0.0 - 1.0.
Returns:
string -The rgba color that was created, like 'rgba(255, 0, 0, 0.3)'.
-
defineLazyProperty(obj, key, getValue, setter)
-
Object.defineProperty but "lazy", which means that the value is only set after it retrieved the first time, rather than being set right away.
Parameters:
Name Type Default Description objObject the object to set the property on
keystring the key for the property to set
getValuefunction the function used to get the value when it is needed.
setterboolean true wether a setter shoould be allowed or not
-
firstSourceWatch(tech)
-
Patches browser internal functions so that we can tell synchronously if a
<source>was appended to the media element. For some reason this causes asourcesetif the the media element is ready and has no source. This happens when:- The page has just loaded and the media element does not have a source.
- The media element was emptied of all sources, then
load()was called.
It does this by patching the following functions/properties when they are supported:
append()- can be used to add a<source>element to the media elementappendChild()- can be used to add a<source>element to the media elementinsertAdjacentHTML()- can be used to add a<source>element to the media elementinnerHTML- can be used to add a<source>element to the media element
Parameters:
Name Type Description techHtml5 The tech object that sourceset is being setup on.
-
getDescriptor()
-
Get a property descriptor given a list of priorities and the property to get.
-
hook(type, The)
-
Add a function hook to a specific videojs lifecycle.
Parameters:
Name Type Description typestring the lifecycle to hook the function to.
Thefunction | Array.<function()> function or array of functions to attach.
-
hookOnce(type, The)
-
Add a function hook that will only run once to a specific videojs lifecycle.
Parameters:
Name Type Description typestring the lifecycle to hook the function to.
Thefunction | Array.<function()> function or array of functions to attach.
-
hooks(type, fnopt) → {Array}
-
Get a list of hooks for a specific lifecycle
Parameters:
Name Type Attributes Description typestring the lifecyle to get hooks from
fnfunction | Array.<function()> <optional>
Optionally add a hook (or hooks) to the lifecycle that your are getting.
Returns:
Array -an array of hooks, or an empty array if there are none.
-
isPromise(value) → {boolean}
-
Returns whether an object is
Promise-like (i.e. has athenmethod).Parameters:
Name Type Description valueObject An object that may or may not be
Promise-like.Returns:
boolean -Whether or not the object is
Promise-like. -
removeHook(type, fn) → {boolean}
-
Remove a hook from a specific videojs lifecycle.
Parameters:
Name Type Description typestring the lifecycle that the function hooked to
fnfunction The hooked function to remove
Returns:
boolean -The function that was removed or undef
-
setupSourceset(tech)
-
setup
sourcesethandling on theHtml5tech. This function patches the following element properties/functions:src- to determine whensrcis setsetAttribute()- to determine whensrcis setload()- this re-triggers the source selection algorithm, and can cause a sourceset.
If there is no source when we are adding
sourcesetsupport or during aload()we also patch the functions listed infirstSourceWatch.Parameters:
Name Type Description techHtml5 The tech to patch
-
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 valueObject An object that may or may not be
Promise-like. -
sourcesetLoad(tech) → {boolean}
-
This function is used to fire a sourceset when there is something similar to
mediaEl.load()being called. It will try to find the source via thesrcattribute and then the<source>elements. It will then firesourcesetwith the source that was found or empty string if we cannot know. If it cannot find a source thensourcesetwill not be fired.Parameters:
Name Type Description techHtml5 The tech object that sourceset was setup on
Returns:
boolean -returns false if the sourceset was not fired and true otherwise.
Type Definitions
-
MenuKeys
-
All keys used for operation of a menu (
MenuButton,Menu, andMenuItem) Note that 'Enter' and 'Space' are not included here (otherwise they would prevent theMenuButtonandMenuItemfrom being keyboard-clickable)