No description
Find a file
2023-04-23 19:28:50 +08:00
.github/workflows update 2022-10-28 11:58:11 +08:00
dist From Js to Typescript + Modernize the build system (#15) 2023-04-23 18:25:22 +08:00
src Remove duplicate type 2023-04-23 19:16:19 +08:00
types Export types 2023-04-23 18:55:29 +08:00
.babelrc From Js to Typescript + Modernize the build system (#15) 2023-04-23 18:25:22 +08:00
.editorconfig first commit 2018-09-07 15:20:51 +08:00
.eslintrc.js From Js to Typescript + Modernize the build system (#15) 2023-04-23 18:25:22 +08:00
.gitignore Initial commit 2018-09-07 13:08:54 +08:00
.ncurc.js From Js to Typescript + Modernize the build system (#15) 2023-04-23 18:25:22 +08:00
.npmignore Ignore File 2023-04-23 19:28:50 +08:00
CHANGELOG.md Publish v2.4.1 2023-04-23 18:58:26 +08:00
LICENSE Initial commit 2018-09-07 13:08:54 +08:00
package-lock.json Publish v2.4.1 2023-04-23 18:58:26 +08:00
package.json Publish v2.4.1 2023-04-23 18:58:26 +08:00
README.md From Js to Typescript + Modernize the build system (#15) 2023-04-23 18:25:22 +08:00
rollup.config.iife.js From Js to Typescript + Modernize the build system (#15) 2023-04-23 18:25:22 +08:00
rollup.config.js From Js to Typescript + Modernize the build system (#15) 2023-04-23 18:25:22 +08:00
tsconfig.json From Js to Typescript + Modernize the build system (#15) 2023-04-23 18:25:22 +08:00

lrc-file-parser

A lrc file parser based javascript

demo

Installation

  • Use npm install
# install
npm install lrc-file-parser
// import
import Lyric from 'lrc-file-parser'
  • Use script link
<script src="./lrc-file-parser.min.js"></script>

How to use

var lrc = new Lyric({
  onPlay: function (line, text) { // Listening play event
    console.log(line, text) // line is line number of current play
                            // text is lyric text of current play line
  },
  onSetLyric: function (lines) { // listening lyrics seting event
    console.log(lines) // lines is array of all lyric text
  },
  offset: 150, // offset time(ms), default is 150 ms
  playbackRate: 1, // playback rate, default is 1
  isRemoveBlankLine: true // is remove blank line, default is true
})

var extendedLyricStrs = [translationLyricStr]
lrc.setLyric(lyricStr, extendedLyricStrs) // set lyric, lyricStr is lyric file text, extendedLyricStrs is extended lyric file text array (optional)
                      // note: Setting the lyrics will automatically pause the lyrics playback
lrc.play(30000) // play lyric, 30000 is curent play time, unit: ms
lrc.pause() // pause lyric

lrc.setPlaybackRate(1.2) // set playback rate to 1.2x

CHANGELOG

See CHANGELOG.md

LICENSE

MIT