JS play music show every word lyrics

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.