music-lyric-utilities
v1.0.4
Published
A Lyric Utils
Downloads
255
Maintainers
Readme
music-lyric-utilities
A Lyric Utils
Installation
- Npm Install
npm install music-lyric-utilities
- Script Link
<script src="./music-lyric-utilities.iife.js"></script>
Use
- Node
import { Parser, Player } from 'music-lyric-utilities'
// parser
const lyricParser = new Parser.LyricParser()
// parser info
const lyricInfo = lyricParser.parse({
original: '',
translated: '',
roman: '',
dynamic: '',
})
// player
const lyricPlayer = new Player.LyricPlayer({
onSetLyric(info) {
console.log('onSetLyric', info)
},
onLinePlay(lineNum, info) {
console.log('onLinePlay', lineNum, info)
},
})
// update lyric
lyricPlayer.updateLyric(lyricInfo)
// play lyric
lyricPlayer.play(0)
- Web
<script>
const { LyricParser, LyricPlayer } = MusicLyricUtilities
const lyricParser = new LyricParser()
const lyricInfo = lyricParser.parse({
original: '',
translated: '',
roman: '',
dynamic: '',
})
const player = new LyricPlayer({
onSetLyric(info) {
console.log('onSetLyric', info)
},
onLinePlay(lineNum, info) {
console.log('onLinePlay', lineNum, info)
},
})
player.updateLyric(lyricInfo)
player.play(0)
</script>
LICENSE
MIT