This article takes the actor of Joker Xue as an example, in the article266097259.LRCFor the lyrics of the actor, I am a beginner, if there is a bad place, please point out the//html file
<! DOCTYPE html>
<meta charset= "UTF-8" >
<title>Title</title>
<script src= "Http://apps.bdimg.com/libs/jquery/1.9.1/jquery.min.js" >
</script>
<body>
<audio id= "Player" src= "Yanyuan.mp3" controls= "Controls" ></audio>
<div id= "Div" ></div>
<script src= "Main.js" ></script>
</body>
JS file
(function () {
var player=document.queryselector ("#player");
var div=document.queryselector ("#div");
var lrc=null;
function playing (lrcstring) {
var lrcobject = {};
var lines = lrcstring.split ("\ n");
var p =/\[(\d{2}):(\d{2}) \.\d{2}\] (. +)/;
for (var i = 0; i < lines.length; i++) {
var t=p.exec (Lines[i]);
if (t) {
var min = parseint (t[1]);
var sec = parseint (t[2]);
var c=t[3];
var time = min * + sec;
lrcobject[time] = C;
}
}
return Lrcobject;
"
$.get (" 266097259.LRC "). Done ( function (data) {
LRC = playing (data);
SetInterval (function () {
if (LRC) {
div.innerhtml = content;
}
}
}, 1000);
JS play music show every word lyrics