Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/funkymed/flod-module-player
ES6 version of Flod's module-player
https://github.com/funkymed/flod-module-player
Last synced: about 2 months ago
JSON representation
ES6 version of Flod's module-player
- Host: GitHub
- URL: https://github.com/funkymed/flod-module-player
- Owner: funkymed
- Created: 2021-08-15T18:19:40.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-08-15T19:29:53.000Z (over 3 years ago)
- Last Synced: 2024-10-11T10:42:10.667Z (3 months ago)
- Language: JavaScript
- Size: 29.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ES6 version of Flod's Module Player
## Original
Updated version of Flod's module player by Christian Corti Neoart Costa Rica.
Original version released the 2012/04/30.
## ES6 version
Cyril Pereira updated Flod to be compatible with ES6.
## How to use it ?
### Install
```bash
yarn add funkymed-flod-module-player --save
```or
```bash
npm install funkymed-flod-module-player
```### Use
#### Load a module
```javascript
import FlodPlayer from "funkymed-flod-module-player/src/FlodPlayer";
import ajaxLoader from "funkymed-flod-module-player/src/ajaxLoader";function onModuleProgress(e) {
if (e.lengthComputable) {
const percentage = Math.round((e.loaded / e.total) * 100);
console.log(percentage);
}
}let player = null;
function onModuleLoaded(bytes) {
if (player) {
player.stop();
}
player = FlodPlayer.load(bytes);
player.loopSong = true;
player.play();
}ajaxLoader("mymod.xm", onModuleLoaded, onModuleProgress);
```#### More
```javascript
const title = player.title; // the title of the module
player.stop(); //stop the module
const analyser = player.analyser; // audio context analyser
```