A .lrc runner written in JavaScript (NodeJS) that works like a music player.
const fs = require('fs');
const LrcPlayer = require('./lrcplayer');
const lrc = fs.readFileSync('./hey-jude.lrc').toString();
const myPlayer = new LrcPlayer(lrc);
myPlayer.on('lrc', (line) => {
console.log(line);
});
myPlayer.play();
The .lrc player
Kind: global class
Creates a new .lrc player
Param | Type | Description |
---|---|---|
lrcFile | string |
the .lrc file to run |
Start player
Kind: instance method of LrcPlayer
Pause player
Kind: instance method of LrcPlayer
Stop player
Kind: instance method of LrcPlayer
Jump to new time
Kind: instance method of LrcPlayer
Param | Type | Description |
---|---|---|
newTime | string | number |
the new time to jump in. In miliseconds or time string (01:20.00) |
Event when player streams lyrics
myPlayer.on('lrc', function(line, time) {
console.log(line);
});
Event when player starts
myPlayer.on('play', function(time) {
console.log('Player started at: ' + time);
});
*similar: