vlitejs
Version:
vLitejs is a fast and lightweight Javascript library for customizing HTML5 and Youtube video players in Javascript with a minimalist theme
2,837 lines (458 loc) • 24.9 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: module:vLite/Player</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">Class: module:vLite/Player</h1>
<section>
<header>
<h2><span class="attribs"><span class="type-signature"></span></span>module:vLite/Player<span class="signature">(selector, options, callback)</span><span class="type-signature"></span></h2>
</header>
<article>
<div class="container-overview">
<h4 class="name" id="module:vLite/Player"><span class="type-signature"></span>new module:vLite/Player<span class="signature">(selector, options, callback)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Instanciate the constructor</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>selector</code></td>
<td class="type">
<span class="param-type">String</span>
|
<span class="param-type">Object</span>
</td>
<td class="description last"><p>CSS selector or query selector</p></td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last"><p>Player options</p></td>
</tr>
<tr>
<td class="name"><code>callback</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last"><p>Callback function executed when the player is ready</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="player.js.html">player.js</a>, <a href="player.js.html#line22">line 22</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id=".checkSupportFullScreen"><span class="type-signature">(static) </span>checkSupportFullScreen<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Check fullscreen support API on different browsers and cached prefixs</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="player.js.html">player.js</a>, <a href="player.js.html#line417">line 417</a>
</li></ul></dd>
</dl>
<h4 class="name" id=".formatVideoTime"><span class="type-signature">(static) </span>formatVideoTime<span class="signature">(time)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Convert video time second to 00:00 display</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>time</code></td>
<td class="type">
<span class="param-type">Float</span>
|
<span class="param-type">Integer</span>
</td>
<td class="description last"><p>Current time</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="player.js.html">player.js</a>, <a href="player.js.html#line599">line 599</a>
</li></ul></dd>
</dl>
<h4 class="name" id="afterPlayPause"><span class="type-signature"></span>afterPlayPause<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Function executed after the play or pause method</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="player.js.html">player.js</a>, <a href="player.js.html#line348">line 348</a>
</li></ul></dd>
</dl>
<h4 class="name" id="bindEvents"><span class="type-signature"></span>bindEvents<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Create event listeners
All listeners are created on class properties to facilitate the deletion of events</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="player.js.html">player.js</a>, <a href="player.js.html#line167">line 167</a>
</li></ul></dd>
</dl>
<h4 class="name" id="buildPlayer"><span class="type-signature"></span>buildPlayer<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Build the DOM of the player</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="player.js.html">player.js</a>, <a href="player.js.html#line86">line 86</a>
</li></ul></dd>
</dl>
<h4 class="name" id="destroy"><span class="type-signature"></span>destroy<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Destroy the player
Remove event listeners, player instance and player HTML</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="player.js.html">player.js</a>, <a href="player.js.html#line572">line 572</a>
</li></ul></dd>
</dl>
<h4 class="name" id="exitFullscreen"><span class="type-signature"></span>exitFullscreen<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Exit fullscreen after user action</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="player.js.html">player.js</a>, <a href="player.js.html#line468">line 468</a>
</li></ul></dd>
</dl>
<h4 class="name" id="fastForward"><span class="type-signature"></span>fastForward<span class="signature">(e)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Trigger the video fast forward (front and rear)</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>e</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last"><p>Event listener datas</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="player.js.html">player.js</a>, <a href="player.js.html#line314">line 314</a>
</li></ul></dd>
</dl>
<h4 class="name" id="isTouch"><span class="type-signature"></span>isTouch<span class="signature">()</span><span class="type-signature"> → {Boolean}</span></h4>
<div class="description">
<p>Check if browser support touch event</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="player.js.html">player.js</a>, <a href="player.js.html#line591">line 591</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Touch event support</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Boolean</span>
</dd>
</dl>
<h4 class="name" id="loading"><span class="type-signature"></span>loading<span class="signature">(state)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Update the loader status</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>state</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="description last"><p>Status of the loader</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="player.js.html">player.js</a>, <a href="player.js.html#line269">line 269</a>
</li></ul></dd>
</dl>
<h4 class="name" id="mute"><span class="type-signature"></span>mute<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Mute the volume on the video</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="player.js.html">player.js</a>, <a href="player.js.html#line382">line 382</a>
</li></ul></dd>
</dl>
<h4 class="name" id="onKeyup"><span class="type-signature"></span>onKeyup<span class="signature">(e)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Function executed on keyup event listener
Toggle the video on spacebar press</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>e</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last"><p>Event listener datas</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="player.js.html">player.js</a>, <a href="player.js.html#line486">line 486</a>
</li></ul></dd>
</dl>
<h4 class="name" id="onMousemove"><span class="type-signature"></span>onMousemove<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Function executed on mousemove event listener
Toggle controls display on mousemove event</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="player.js.html">player.js</a>, <a href="player.js.html#line496">line 496</a>
</li></ul></dd>
</dl>
<h4 class="name" id="onVideoEnded"><span class="type-signature"></span>onVideoEnded<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Function executed when is video is ended</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="player.js.html">player.js</a>, <a href="player.js.html#line287">line 287</a>
</li></ul></dd>
</dl>
<h4 class="name" id="pause"><span class="type-signature"></span>pause<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Pause the video</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="player.js.html">player.js</a>, <a href="player.js.html#line339">line 339</a>
</li></ul></dd>
</dl>
<h4 class="name" id="play"><span class="type-signature"></span>play<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Play the video</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="player.js.html">player.js</a>, <a href="player.js.html#line325">line 325</a>
</li></ul></dd>
</dl>
<h4 class="name" id="playerIsReady"><span class="type-signature"></span>playerIsReady<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Function executed when the player is ready</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="player.js.html">player.js</a>, <a href="player.js.html#line251">line 251</a>
</li></ul></dd>
</dl>
<h4 class="name" id="requestFullscreen"><span class="type-signature"></span>requestFullscreen<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Request fullscreen after user action</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="player.js.html">player.js</a>, <a href="player.js.html#line453">line 453</a>
</li></ul></dd>
</dl>
<h4 class="name" id="seekTo"><span class="type-signature"></span>seekTo<span class="signature">(newTime)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Update the current time of the video</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>newTime</code></td>
<td class="type">
<span class="param-type">Float</span>
|
<span class="param-type">Integer</span>
</td>
<td class="description last"><p>New current time of the video</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="player.js.html">player.js</a>, <a href="player.js.html#line399">line 399</a>
</li></ul></dd>
</dl>
<h4 class="name" id="toggleFullscreen"><span class="type-signature"></span>toggleFullscreen<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Toggle the fullscreen of the video</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="player.js.html">player.js</a>, <a href="player.js.html#line406">line 406</a>
</li></ul></dd>
</dl>
<h4 class="name" id="togglePlayPause"><span class="type-signature"></span>togglePlayPause<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Function executed to toggle the video status (play, pause)</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="player.js.html">player.js</a>, <a href="player.js.html#line302">line 302</a>
</li></ul></dd>
</dl>
<h4 class="name" id="toggleVolume"><span class="type-signature"></span>toggleVolume<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Toggle the volume on the video</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="player.js.html">player.js</a>, <a href="player.js.html#line369">line 369</a>
</li></ul></dd>
</dl>
<h4 class="name" id="unBindEvents"><span class="type-signature"></span>unBindEvents<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Unbind event listeners</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="player.js.html">player.js</a>, <a href="player.js.html#line526">line 526</a>
</li></ul></dd>
</dl>
<h4 class="name" id="unMute"><span class="type-signature"></span>unMute<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Toggle the volume on the video</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="player.js.html">player.js</a>, <a href="player.js.html#line390">line 390</a>
</li></ul></dd>
</dl>
<h4 class="name" id="updateCurrentTime"><span class="type-signature"></span>updateCurrentTime<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Update current time displaying in the control bar and the width of the progress bar</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="player.js.html">player.js</a>, <a href="player.js.html#line510">line 510</a>
</li></ul></dd>
</dl>
<h4 class="name" id="updateDuration"><span class="type-signature"></span>updateDuration<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Update player duration</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="player.js.html">player.js</a>, <a href="player.js.html#line280">line 280</a>
</li></ul></dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-vLite_entrypoint.html">vLite/entrypoint</a></li><li><a href="module-vLite_Player.html">vLite/Player</a></li><li><a href="module-vLite_Player_PlayerHtml5.html">vLite/Player/PlayerHtml5</a></li><li><a href="module-vLite_Player_PlayerYoutube.html">vLite/Player/PlayerYoutube</a></li></ul><h3>Classes</h3><ul><li><a href="module-vLite_entrypoint.html">vLite/entrypoint</a></li><li><a href="module-vLite_Player.html">vLite/Player</a></li><li><a href="module-vLite_Player_PlayerHtml5.html">vLite/Player/PlayerHtml5</a></li><li><a href="module-vLite_Player_PlayerYoutube.html">vLite/Player/PlayerYoutube</a></li></ul><h3>Global</h3><ul><li><a href="global.html#vLitejs">vLitejs</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Tue Nov 19 2019 00:24:53 GMT+0100 (CET)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>