A Jekyll-based site for sharing programming experiences.
frank-deng / js-lyrics Goto Github PK
View Code? Open in Web Editor NEWA JavaScript library for parsing LRC file and synchronize lyrics.
License: MIT License
A JavaScript library for parsing LRC file and synchronize lyrics.
License: MIT License
A Jekyll-based site for sharing programming experiences.
i have project name is test and inside project i have file .lrc but when i'm use var lrc = new Lyrics('/test/file.lrc') in file index.html result from instant is
Lyrics {timestamp_offset: 0, lyrics_all: undefined, meta_info: undefined, ID_TAGS: Array(9)}
ID_TAGS: (9) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]
lyrics_all: undefined
meta_info: undefined
timestamp_offset: 0
proto: Object
how to solve this?
i think my path file lrc is right
lyric_selected.setAttribute is not a function at HTMLAudioElement.
var lrc = new Lyrics(LRC_text);
document.getElementById('audio_player').addEventListener('timeupdate', function(){
//Unhighlight all the lyrics
var lyric_selected = lyrics_container.querySelectorAll('[selected]');
for (var i = 0; i < lyric_selected.length; i++) {
lyric_selected[i].removeAttribute('selected');
}
//Get the lyric to highlight
var lyric_selected = lrc.select(this.currentTime);
//Highlight the lyric
if (lyric_selected != undefined && lyric_selected >= 0) {
lyric_selected.setAttribute('selected', 'selected');
}
});
i got error when lyric_selected.setAttribute('selected','selected'); i dont know why, but the error is setAttribute is not function
模拟触发Bug:
var firstLine = new Lyrics([00:04.050] firstLine
);
var secondLine = new Lyrics([00:04.050] secondLine
);
firstLine.getLyrics();//secondLine
secondLine.getLyrics();//secondLine
原因:构造函数的书写方式有问题。
解决方法:我已Fork并上传修改后的源码。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.