Members
constant findMimetype
[utils/mimetypes.js](https://docs.videojs.com/utils_mimetypes.js.html)
, [line 62](https://docs.videojs.com/utils_mimetypes.js.html#line62)
Find the mime type of a given source string if possible. Uses the player source cache.
constant getMimetype
[utils/mimetypes.js](https://docs.videojs.com/utils_mimetypes.js.html)
, [line 42](https://docs.videojs.com/utils_mimetypes.js.html#line42)
Get the mimetype of a given src url if possible
constant innerHTMLDescriptorPolyfill
[tech/setup-sourceset.js](https://docs.videojs.com/tech_setup-sourceset.js.html)
, [line 77](https://docs.videojs.com/tech_setup-sourceset.js.html#line77)
our implementation of an innerHTML
descriptor for browsers that do not have one.
constant srcDescriptorPolyfill
[tech/setup-sourceset.js](https://docs.videojs.com/tech_setup-sourceset.js.html)
, [line 207](https://docs.videojs.com/tech_setup-sourceset.js.html#line207)
our implementation of a src
descriptor for browsers that do not have one.
Methods
clamp(number, min, max) → {number}
[utils/clamp.js](https://docs.videojs.com/utils_clamp.js.html)
, [line 15](https://docs.videojs.com/utils_clamp.js.html#line15)
Keep a number between a min and a max value
Parameters:
Name | Type | Description |
---|---|---|
number | number | The number to clamp |
min | number | The minimum value |
max | number | The maximum value |
Returns:
number -
the clamped number
constructColor(color, opacity) → {string}
[tracks/text-track-display.js](https://docs.videojs.com/tracks_text-track-display.js.html)
, [line 36](https://docs.videojs.com/tracks_text-track-display.js.html#line36)
Construct an rgba color from a given hex color code.
Parameters:
Name | Type | Description |
---|---|---|
color | number | Hex number for color, like #f0e or #f604e2. |
opacity | number | 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)
[utils/define-lazy-property.js](https://docs.videojs.com/utils_define-lazy-property.js.html)
, [line 10](https://docs.videojs.com/utils_define-lazy-property.js.html#line10)
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 |
---|---|---|---|
obj | Object | the object to set the property on | |
key | string | the key for the property to set | |
getValue | function | the function used to get the value when it is needed. | |
setter | boolean | true | wether a setter shoould be allowed or not |
firstSourceWatch(tech)
[tech/setup-sourceset.js](https://docs.videojs.com/tech_setup-sourceset.js.html)
, [line 155](https://docs.videojs.com/tech_setup-sourceset.js.html#line155)
Patches browser internal functions so that we can tell synchronously if a <source>
was appended to the media element. For some reason this causes a sourceset
if 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 |
---|---|---|
tech | Html5 | The tech object that sourceset is being setup on. |
getDescriptor()
[tech/setup-sourceset.js](https://docs.videojs.com/tech_setup-sourceset.js.html)
, [line 113](https://docs.videojs.com/tech_setup-sourceset.js.html#line113)
Get a property descriptor given a list of priorities and the property to get.
isPromise(value) → {boolean}
[utils/promise.js](https://docs.videojs.com/utils_promise.js.html)
, [line 11](https://docs.videojs.com/utils_promise.js.html#line11)
Returns whether an object is Promise
-like (i.e. has a then
method).
Parameters:
Name | Type | Description |
---|---|---|
value | Object | An object that may or may not be |
Returns:
boolean -
Whether or not the object is Promise
-like.
setupSourceset(tech)
[tech/setup-sourceset.js](https://docs.videojs.com/tech_setup-sourceset.js.html)
, [line 239](https://docs.videojs.com/tech_setup-sourceset.js.html#line239)
setup sourceset
handling on the Html5
tech. This function patches the following element properties/functions:
src
- to determine whensrc
is setsetAttribute()
- to determine whensrc
is setload()
- this re-triggers the source selection algorithm, and can cause a sourceset.
If there is no source when we are adding sourceset
support or during a load()
we also patch the functions listed in firstSourceWatch
.
Parameters:
Name | Type | Description |
---|---|---|
tech | Html5 | The tech to patch |
silencePromise(value)
[utils/promise.js](https://docs.videojs.com/utils_promise.js.html)
, [line 24](https://docs.videojs.com/utils_promise.js.html#line24)
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 |
sourcesetLoad(tech) → {boolean}
[tech/setup-sourceset.js](https://docs.videojs.com/tech_setup-sourceset.js.html)
, [line 19](https://docs.videojs.com/tech_setup-sourceset.js.html#line19)
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 the src
attribute and then the <source>
elements. It will then fire sourceset
with the source that was found or empty string if we cannot know. If it cannot find a source then sourceset
will not be fired.
Parameters:
Name | Type | Description |
---|---|---|
tech | Html5 | The tech object that sourceset was setup on |
Returns:
boolean -
returns false if the sourceset was not fired and true otherwise.
Type Definitions
MenuKeys
[menu/menu-keys.js](https://docs.videojs.com/menu_menu-keys.js.html)
, [line 5](https://docs.videojs.com/menu_menu-keys.js.html#line5)
All keys used for operation of a menu (MenuButton
, Menu
, and MenuItem
) Note that ‘Enter’ and ‘Space’ are not included here (otherwise they would prevent the MenuButton
and MenuItem
from being keyboard-clickable)