forked from Mooooooon/Musicoon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
88 lines (82 loc) · 2.41 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Muscioon</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="back">
<div class="container">
<div class="player">
<div class="cd">
<div class="out">
</div>
<div id="album" class="album">
</div>
<div id="in" class="in">
</div>
</div>
<div class="action">
<a href="javascript:m_play()"><img id="m_play" src="images/play.png"></a>
<input id="range" type="range" min="0" max="10" value="5" onchange="volume(this.value)">
<a href="javascript:next_music()"><img id="next_music" src="images/forward.png"></a>
</div>
<audio id="player">
</audio>
</div>
</div>
</div>
<script src="js/jquery-1.11.1.min.js"></script>
<script>
oAudio = document.getElementById('player');
btn = $("#m_play");
album = $("#album");
inn = $("#in");
$(document).ready(function () {
$.get("player.php", function (data) {
mp3_info = JSON.parse(data);
$("#player").attr("src", mp3_info.mp3);
$("#album").css("background-image", "url('" + mp3_info.cover + "')");
});
oAudio.volume = 0.5;
});
$("#player").bind("ended", function () {
next_music();
});
function m_play() {
if (oAudio.paused) {
oAudio.play();
btn.attr("src", "images/pause.png");
album.addClass("roll");
inn.addClass("roll");
}
else {
oAudio.pause();
btn.attr("src", "images/play.png");
album.removeClass("roll");
inn.removeClass("roll");
}
}
function next_music() {
album.removeClass("roll");
inn.removeClass("roll");
load_music();
btn.attr("src", "images/pause.png");
album.addClass("roll");
inn.addClass("roll");
}
function load_music() {
$.get("player.php", function (data) {
mp3_info = JSON.parse(data);
$("#player").attr("src", mp3_info.mp3);
$("#album").css("background-image", "url('" + mp3_info.cover + "')");
oAudio.play();
});
}
function volume(vol) {
oAudio.volume = vol / 10;
}
</script>
</body>
</html>