-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathindex.html
91 lines (89 loc) · 3.54 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>hey-Audio</title>
<link rel="stylesheet" href="css/music.css">
</head>
<body class="blueHour">
<div class="search">
<input id="keyword" type="text">
<a id="search-btn" href="javascript:;">网易云搜一下</a>
<span id="result"></span>
</div>
<div class="container">
<div class="music-list">
<div class="title">默认歌单</div>
<div class="list">
<ul>
<li>你在终点等我</li>
<li>白昼之夜(纯音乐)</li>
<li>告白气球</li>
<li>那就这样吧</li>
<li>骄傲的少年</li>
<li>岁月神偷</li>
</ul>
</div>
</div>
<audio id="audio">
<source title="你在终点等我" data-img="http://p1.music.126.net/ddhcDeGSl9VhXJLfOsNDEA==/3433774824740403.jpg" src="http://link.hhtjim.com/163/431357712.mp3">
<source title="白昼之夜(纯音乐)" data-img="http://p1.music.126.net/he7P6CYpQmz8KqYSdULuOQ==/94557999994394.jpg" src="http://oc1475jft.bkt.clouddn.com/baizhouzhiye.mp3">
<source title="告白气球" data-img="http://p1.music.126.net/tlp3VWVQVe0Je1r-oHn91g==/17666952835430891.jpg" src="http://oc1475jft.bkt.clouddn.com/gaobaiqiqiu.mp3">
<source title="那就这样吧" data-img="http://p1.music.126.net/fYNa5MMN0KTIYP2KMpYObQ==/17923139044585525.jpg" src="http://link.hhtjim.com/163/28949843.mp3">
<source title="骄傲的少年" data-img="http://p1.music.126.net/Brn39jwEDNPVV6pNWcv_rA==/1391981724588577.jpg" src="http://link.hhtjim.com/163/408332757.mp3">
<source title="岁月神偷" data-img="http://p1.music.126.net/54wdQi_3rpjreY2oo2jb7w==/5998935441219557.jpg" src="http://link.hhtjim.com/163/28285910.mp3">
</audio>
<div class="music">
<div class="header">
<h1>hey-Audio <small>音乐播放器</small></h1>
</div>
<div class="fengmian">
<img src="img/music.png" id="music-img" alt="">
</div>
<div id="title">
hey!
</div>
<div class="jindu">
<span id="music-bar">
<span id="load-bar"></span>
<span id="played-bar"></span>
</span>
<span id="voice-bar">
<span id="voiced-bar"></span>
</span>
<div id="time">
<span id="current-time">0:00</span>
<span id="total-time"></span>
</div>
</div>
<div class="controls">
<a id="xunhuan" href="javascript:;">循环</a>
<a id="prev" href="javascript:;"><</a>
<a id="play" href="javascript:;">Play</a>
<a id="next" href="javascript:;">></a>
<a id="jingyin" href="javascript:;">静音</a>
</div>
</div>
</div>
<div id="footer">
<a href="https://fehey.com/" target="_blank">博客</a>
<a href="https://github.com/EryouHao/hey-Audio" target="_blank">github源码</a>
</div>
<script src="js/music.js"></script>
<script>
// 回调函数将返回的内容添加到结果区(需要在页面加载完后加载上,为后面执行回调)
function jsonpcallback (rs) {
var resultHtml = '歌曲:<strong>' + rs.result.songs[0].name + '</strong>' +
'歌手:<strong>' + rs.result.songs[0].artists[0].name + '</strong>' +
'<a href="javascript:;" id="to-play">立即播放</a>';
result.innerHTML = resultHtml;
result.setAttribute('data-audio', rs.result.songs[0].audio);
result.setAttribute('data-img', rs.result.songs[0].album.picUrl);
result.setAttribute('data-music', rs.result.songs[0].name);
result.setAttribute('data-singer', rs.result.songs[0].artists[0].name);
result.style.opacity = '1';
};
</script>
</body>
</html>