ivp-webplayer
v1.0.31
Published
In order to use the IVP Webplayer, you need to install some assets to your project. In which directory depends on the framework you use. To help you we designed a helper script with examples for Angular and React.
Downloads
9
Readme
INSTALL INSTRUCTIONS
In order to use the IVP Webplayer, you need to install some assets to your project. In which directory depends on the framework you use. To help you we designed a helper script with examples for Angular and React.
After installing the node module with:
npm install ivp-webplayer --save
You can run the post install script like this:
node ./node_modules/ivp-webplayer/post-install.js
IMPLEMENTATION INSTRUCTIONS
Initializing
To use the IVP Webplayer, you need to import the module like this:
import ivp from 'ivp-webplayer';
The init function requires 3 arguments: targetElementId, baseUrl and a statusUpdateCallback. The baseUrl is the baseUrl of the public available assets (where the IVP assets are copied to).
example to initialize:
ivp.initIvpPlayer("ivp-player", this.state.baseUrl, this.statusUpdate);
statusUpdate(status) {
console.log(status);
}
Controlling
You can control the IVP with the same module. It's very basic at the moment and supports the following command:
- ivp.setOnlineBaseUrl(url); // base url where all online video's are stored
- ivp.loadVideoById(videoId); // requires online base url to be set, videoId will be subfolder of that
- ivp.loadVideoByUrl(url); // load video from absolute path to video.json
- ivp.play();
- ivp.pause();
- ivp.toggleDebug();
- ivp.toggleSubtitles();
- ivp.jumpTo(time, forcePlay); // time is seconds in decimal, forcePlay is boolean.
DEVELOPMENT INSTRUCTIONS
Warning 1
After building the flutter web app to update this package, in the service worker you need to remove the references to index.html.
Warning 2
Make sure you update the service worker version in index.js on updating the flutter app
Warning 3
There is a bug in the generated main.dart.js. Loading libraries does not respect the assetsBase. Therefor, after updating the player, you need to search for "./assets/packages/" in main.dart.js and replace it with: "." + window.ivp_base_url + "assets/packages/"