Setup
What's Included
The library package includes the following:
- API Documentation
- Library files (ES6, IIFE bundles)
- Sample App
ES6 vs IIFE Bundles
Modern browsers support module scripts, so script tags with the nomodule
attribute will be ignored, and script tags with a type of module
will be fetched and evaluated (ES6). For other browsers, the nomodule
attribute can be used as a fallback.
Classic browsers will ignore script tags with a type of module
, as that is an unknown type for them.
ES6 modules are available for modern browsers. Include the ES6 library script and respective imports.
IIFE bundles are available for both classic and modern browsers.
<!-- ES6 Import -->
<script async type="module">
import { createPlayerBuilder } from '../dist/web/fl-player.es6.js';
</script>
<!-- Use dynamic ES import with async/await -->
<script type="module">
(async () => {
// Import from named export:
const { createPlayerBuilder } = await import('../dist/web/fl-player.es6.js');
const playerBuilder = createPlayerBuilder();
})();
</script>
<!-- IIFE Import -->
<script src="../dist/web/fl-foundation.iife.js"></script>
<script src="../dist/web/fl-player-interface.iife.js"></script>
<script src="../dist/web/fl-player.iife.js"></script>
Polyfills
The following polyfills might be required on certain target platforms (Tizen, Xbox, Comcast X1, LG WebOS, and PS):
Array.prototype.includes
Object.assign
Object.entries
Object.values
Closed Captions
Include mux.js v5.7.0+ for CEA-608 and CEA-708 captions support:
npm install --save mux.js
<script src="https://github.com/videojs/mux.js/releases/latest/download/mux.js"></script>
FLPlayer does not bundle these polyfills to avoid bloating the libraries for targets that do not need them and to avoid potential duplicate polyfill installations from various libraries on the host app.