Setup
What's Included
The library package would include the following:
- API Documentation
- Library files (ES6, IIFE bundles)
- Sample App
ES6 Vs IIFE bundles
As most modern browsers support module scripts, script tag with the nomodule attribute will be ignored, and script tag with a type of "module" will be fetched and evaluated.(ES6). For other browser, nomodule attribute can be used for fallback
Classic browsers will ignore the script tag with a type of "module", as that is an unknown type for them.
ES6 modules are available for the modern browser. Include the es6 library script and respective imports can be done.
IIFE bundles are available for the classic browser as well as modern browser.
<!-- 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, 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 libs for targets which do not need them and to avoid potential duplicate polyfill install from various libs on the host app.