Methods
autoadvance(delay)
Sets up auto-advance on the playlist.
Parameters:
| Name | Type | Description |
|---|---|---|
delay |
number | The number of seconds to wait before each auto-advance. |
- Source:
clearTracks(player)
Removes all remote text tracks from a player.
Parameters:
| Name | Type | Description |
|---|---|---|
player |
Player | The player to clear tracks on |
- Source:
contains(value) → {boolean}
Checks if the playlist contains a value.
Parameters:
| Name | Type | Description |
|---|---|---|
value |
string | Object | Array | The value to check |
- Source:
Returns:
The result
- Type
- boolean
currentItem(indexopt) → {number}
Get or set the current item in the playlist.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
index |
number |
<optional> |
If given as a valid value, plays the playlist item at that index. |
- Source:
Returns:
The current item index.
- Type
- number
factory(player, initialListopt, initialIndexopt) → {function}
Factory function for creating new playlist implementation on the given player.
API summary:
playlist(['a', 'b', 'c']) // setter playlist() // getter playlist.currentItem() // getter, 0 playlist.currentItem(1) // setter, 1 playlist.next() // 'c' playlist.previous() // 'b' playlist.first() // 'a' playlist.last() // 'c' playlist.autoadvance(5) // 5 second delay playlist.autoadvance() // cancel autoadvance
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
player |
Player | The current player |
||
initialList |
Array |
<optional> |
If given, an initial list of sources with which to populate the playlist. |
|
initialIndex |
number |
<optional> |
0 | If given, the index of the item in the list that should be loaded first. If -1, no video is loaded. If omitted, The the first video is loaded. |
- Source:
Returns:
Returns the playlist function specific to the given player.
- Type
- function
first() → {Object|undefined}
Plays the first item in the playlist.
- Source:
Returns:
Returns undefined and has no side effects if the list is empty.
- Type
- Object | undefined
indexOf(value) → {number}
Gets the index of a value in the playlist or -1 if not found.
Parameters:
| Name | Type | Description |
|---|---|---|
value |
string | Object | Array | The value to find the index of |
- Source:
Returns:
The index or -1
- Type
- number
last() → {Object|undefined}
Plays the last item in the playlist.
- Source:
Returns:
Returns undefined and has no side effects if the list is empty.
- Type
- Object | undefined
next() → {Object|undefined}
Plays the next item in the playlist.
- Source:
Returns:
Returns undefined and has no side effects if on last item.
- Type
- Object | undefined
playItem(player, delay, item) → {Player}
Plays an item on a player's playlist.
Parameters:
| Name | Type | Description |
|---|---|---|
player |
Player | The player to play the item on |
delay |
number | The number of seconds to wait before each auto-advance. |
item |
Object | A source from the playlist. |
- Source:
Returns:
The player that is now playing the item
- Type
- Player
plugin(list, item)
The video.js playlist plugin. Invokes the playlist-maker to create a playlist function on the specific player.
Parameters:
| Name | Type | Description |
|---|---|---|
list |
Array | a list of sources |
item |
number | The index to start at |
previous() → {Object|undefined}
Plays the previous item in the playlist.
- Source:
Returns:
Returns undefined and has no side effects if on first item.
- Type
- Object | undefined
repeat(valopt) → {boolean}
Sets repeat option, which makes the "next" video of the last video in the
playlist be the first video in the playlist.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
val |
boolean |
<optional> |
The value to set repeat to |
- Source:
Returns:
The current value of repeat
- Type
- boolean
reset(player)
Resets the auto-advance behavior of a player.
Parameters:
| Name | Type | Description |
|---|---|---|
player |
Player | The player to reset the behavior on |
- Source:
setReset_(fn)
Used to change the reset function in this module at runtime This should only be used in tests.
Parameters:
| Name | Type | Description |
|---|---|---|
fn |
function | The function to se the reset to |
- Source:
setup(player, delay) → {undefined}
Sets up auto-advance behavior on a player.
Parameters:
| Name | Type | Description |
|---|---|---|
player |
Player | the current player |
delay |
number | The number of seconds to wait before each auto-advance. |
- Source:
Returns:
Used to short circuit function logic
- Type
- undefined