Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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
```