UNPKG

videojs-playlist

Version:
2,584 lines (660 loc) 28.2 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Global</title> <script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/lang-css.js"> </script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <div id="main"> <h1 class="page-title">Global</h1> <section> <header> <h2></h2> </header> <article> <div class="container-overview"> <dl class="details"> </dl> </div> <h3 class="subsection-title">Methods</h3> <h4 class="name" id="autoadvance"><span class="type-signature"></span>autoadvance<span class="signature">(delay)</span><span class="type-signature"></span></h4> <div class="description"> <p>Sets up auto-advance on the playlist.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>delay</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The number of seconds to wait before each auto-advance.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="playlist-maker.js.html">playlist-maker.js</a>, <a href="playlist-maker.js.html#line316">line 316</a> </li></ul></dd> </dl> <h4 class="name" id="clearTracks"><span class="type-signature"></span>clearTracks<span class="signature">(player)</span><span class="type-signature"></span></h4> <div class="description"> <p>Removes all remote text tracks from a player.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>player</code></td> <td class="type"> <span class="param-type">Player</span> </td> <td class="description last"><p>The player to clear tracks on</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="play-item.js.html">play-item.js</a>, <a href="play-item.js.html#line9">line 9</a> </li></ul></dd> </dl> <h4 class="name" id="contains"><span class="type-signature"></span>contains<span class="signature">(value)</span><span class="type-signature"> &rarr; {boolean}</span></h4> <div class="description"> <p>Checks if the playlist contains a value.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>value</code></td> <td class="type"> <span class="param-type">string</span> | <span class="param-type">Object</span> | <span class="param-type">Array</span> </td> <td class="description last"><p>The value to check</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="playlist-maker.js.html">playlist-maker.js</a>, <a href="playlist-maker.js.html#line205">line 205</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>The result</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">boolean</span> </dd> </dl> <h4 class="name" id="currentItem"><span class="type-signature"></span>currentItem<span class="signature">(index<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {number}</span></h4> <div class="description"> <p>Get or set the current item in the playlist.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>index</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last"><p>If given as a valid value, plays the playlist item at that index.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="playlist-maker.js.html">playlist-maker.js</a>, <a href="playlist-maker.js.html#line176">line 176</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>The current item index.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">number</span> </dd> </dl> <h4 class="name" id="factory"><span class="type-signature"></span>factory<span class="signature">(player, initialList<span class="signature-attributes">opt</span>, initialIndex<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {function}</span></h4> <div class="description"> <p>Factory function for creating new playlist implementation on the given player.</p> <p>API summary:</p> <p>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</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>player</code></td> <td class="type"> <span class="param-type">Player</span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"><p>The current player</p></td> </tr> <tr> <td class="name"><code>initialList</code></td> <td class="type"> <span class="param-type">Array</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last"><p>If given, an initial list of sources with which to populate the playlist.</p></td> </tr> <tr> <td class="name"><code>initialIndex</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> 0 </td> <td class="description last"><p>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.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="playlist-maker.js.html">playlist-maker.js</a>, <a href="playlist-maker.js.html#line115">line 115</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Returns the playlist function specific to the given player.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">function</span> </dd> </dl> <h4 class="name" id="first"><span class="type-signature"></span>first<span class="signature">()</span><span class="type-signature"> &rarr; {Object|undefined}</span></h4> <div class="description"> <p>Plays the first item in the playlist.</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="playlist-maker.js.html">playlist-maker.js</a>, <a href="playlist-maker.js.html#line244">line 244</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Returns undefined and has no side effects if the list is empty.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Object</span> | <span class="param-type">undefined</span> </dd> </dl> <h4 class="name" id="indexOf"><span class="type-signature"></span>indexOf<span class="signature">(value)</span><span class="type-signature"> &rarr; {number}</span></h4> <div class="description"> <p>Gets the index of a value in the playlist or -1 if not found.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>value</code></td> <td class="type"> <span class="param-type">string</span> | <span class="param-type">Object</span> | <span class="param-type">Array</span> </td> <td class="description last"><p>The value to find the index of</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="playlist-maker.js.html">playlist-maker.js</a>, <a href="playlist-maker.js.html#line218">line 218</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>The index or -1</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">number</span> </dd> </dl> <h4 class="name" id="last"><span class="type-signature"></span>last<span class="signature">()</span><span class="type-signature"> &rarr; {Object|undefined}</span></h4> <div class="description"> <p>Plays the last item in the playlist.</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="playlist-maker.js.html">playlist-maker.js</a>, <a href="playlist-maker.js.html#line258">line 258</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Returns undefined and has no side effects if the list is empty.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Object</span> | <span class="param-type">undefined</span> </dd> </dl> <h4 class="name" id="next"><span class="type-signature"></span>next<span class="signature">()</span><span class="type-signature"> &rarr; {Object|undefined}</span></h4> <div class="description"> <p>Plays the next item in the playlist.</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="playlist-maker.js.html">playlist-maker.js</a>, <a href="playlist-maker.js.html#line272">line 272</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Returns undefined and has no side effects if on last item.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Object</span> | <span class="param-type">undefined</span> </dd> </dl> <h4 class="name" id="playItem"><span class="type-signature"></span>playItem<span class="signature">(player, delay, item)</span><span class="type-signature"> &rarr; {Player}</span></h4> <div class="description"> <p>Plays an item on a player's playlist.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>player</code></td> <td class="type"> <span class="param-type">Player</span> </td> <td class="description last"><p>The player to play the item on</p></td> </tr> <tr> <td class="name"><code>delay</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The number of seconds to wait before each auto-advance.</p></td> </tr> <tr> <td class="name"><code>item</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"><p>A source from the playlist.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="play-item.js.html">play-item.js</a>, <a href="play-item.js.html#line35">line 35</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>The player that is now playing the item</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Player</span> </dd> </dl> <h4 class="name" id="plugin"><span class="type-signature"></span>plugin<span class="signature">(list, item)</span><span class="type-signature"></span></h4> <div class="description"> <p>The video.js playlist plugin. Invokes the playlist-maker to create a playlist function on the specific player.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>list</code></td> <td class="type"> <span class="param-type">Array</span> </td> <td class="description last"><p>a list of sources</p></td> </tr> <tr> <td class="name"><code>item</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The index to start at</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="plugin.js.html">plugin.js</a>, <a href="plugin.js.html#line17">line 17</a> </li></ul></dd> </dl> <h4 class="name" id="previous"><span class="type-signature"></span>previous<span class="signature">()</span><span class="type-signature"> &rarr; {Object|undefined}</span></h4> <div class="description"> <p>Plays the previous item in the playlist.</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="playlist-maker.js.html">playlist-maker.js</a>, <a href="playlist-maker.js.html#line300">line 300</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Returns undefined and has no side effects if on first item.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Object</span> | <span class="param-type">undefined</span> </dd> </dl> <h4 class="name" id="repeat"><span class="type-signature"></span>repeat<span class="signature">(val<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {boolean}</span></h4> <div class="description"> <p>Sets <code>repeat</code> option, which makes the &quot;next&quot; video of the last video in the playlist be the first video in the playlist.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>val</code></td> <td class="type"> <span class="param-type">boolean</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last"><p>The value to set repeat to</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="playlist-maker.js.html">playlist-maker.js</a>, <a href="playlist-maker.js.html#line331">line 331</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>The current value of repeat</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">boolean</span> </dd> </dl> <h4 class="name" id="reset"><span class="type-signature"></span>reset<span class="signature">(player)</span><span class="type-signature"></span></h4> <div class="description"> <p>Resets the auto-advance behavior of a player.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>player</code></td> <td class="type"> <span class="param-type">Player</span> </td> <td class="description last"><p>The player to reset the behavior on</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="auto-advance.js.html">auto-advance.js</a>, <a href="auto-advance.js.html#line22">line 22</a> </li></ul></dd> </dl> <h4 class="name" id="setReset_"><span class="type-signature"></span>setReset_<span class="signature">(fn)</span><span class="type-signature"></span></h4> <div class="description"> <p>Used to change the reset function in this module at runtime This should only be used in tests.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>fn</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last"><p>The function to se the reset to</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="auto-advance.js.html">auto-advance.js</a>, <a href="auto-advance.js.html#line73">line 73</a> </li></ul></dd> </dl> <h4 class="name" id="setup"><span class="type-signature"></span>setup<span class="signature">(player, delay)</span><span class="type-signature"> &rarr; {undefined}</span></h4> <div class="description"> <p>Sets up auto-advance behavior on a player.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>player</code></td> <td class="type"> <span class="param-type">Player</span> </td> <td class="description last"><p>the current player</p></td> </tr> <tr> <td class="name"><code>delay</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The number of seconds to wait before each auto-advance.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="auto-advance.js.html">auto-advance.js</a>, <a href="auto-advance.js.html#line47">line 47</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Used to short circuit function logic</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">undefined</span> </dd> </dl> </article> </section> </div> <nav> <h2><a href="index.html">Home</a></h2><h3>Global</h3><ul><li><a href="global.html#autoadvance">autoadvance</a></li><li><a href="global.html#clearTracks">clearTracks</a></li><li><a href="global.html#contains">contains</a></li><li><a href="global.html#currentItem">currentItem</a></li><li><a href="global.html#factory">factory</a></li><li><a href="global.html#first">first</a></li><li><a href="global.html#indexOf">indexOf</a></li><li><a href="global.html#last">last</a></li><li><a href="global.html#next">next</a></li><li><a href="global.html#playItem">playItem</a></li><li><a href="global.html#plugin">plugin</a></li><li><a href="global.html#previous">previous</a></li><li><a href="global.html#repeat">repeat</a></li><li><a href="global.html#reset">reset</a></li><li><a href="global.html#setReset_">setReset_</a></li><li><a href="global.html#setup">setup</a></li></ul> </nav> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Mon Nov 13 2017 16:41:55 GMT-0500 (EST) </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"> </script> </body> </html>