-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
150 lines (134 loc) · 4 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<!doctype html>
<html>
<head>
<title>Audio Player</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<style type="text/css">
#player {
width: 30%;
position: relative;
left: 30%;
top: 20%;
min-height: 200px;
border: solid 1px #d5d5d5;
background-color: ghostwhite;
}
#audioPlayer {
/* display: none; */
height: 100px;
width: 100%;
height: 13%;
/* border-radius: 115px; */
border: solid 1px #d5d5d5;
position: relative;
margin-top: -57px;
}
li {
display: none;
}
#but {
border-top: solid 2px grey;
padding-top: 3%;
padding-bottom: 5%
}
button {
margin-left: 15%;
}
button img {
width: 50px;
height: 50px;
}
input[type="text"] {
width: 90%;
border-radius: 5px;
}
p {
font-weight: bold;
font-size: 18px;
}
#top {
background-color: pink;
width: 100%;
height: 250px;
}
#top p {
text-align: center;
}
#top img {
width: 100%;
height: 101%;
margin-top: -7%;
}
</style>
</head>
<body>
<div id="player">
<div id="top">
<p>Music Player</p>
<audio id="audioPlayer" controls src="">
</audio>
<div>
<img src="/rajat17sharma/observe/blob/master/top_back.gif">
</div>
<ul id="playlist">
<li>
<a href=""></a>
</li>
</ul>
<br>
</div>
<div id="but">
<p>Url:
<input type="text" id="link" placeholder="Enter the URL of the song you want to play">
</p>
<button type="button" id="play"><img src="/rajat17sharma/observe/blob/master/play.png" alt="play"></button>
<button type="button" id="pause"><img src="/rajat17sharma/observe/blob/master/pause.png" alt="pause"></button>
<button type="button" id="stop"><img src="/rajat17sharma/observe/blob/master/stop.png" alt="stop"></button>
</div>
</div>
<script type="text/javascript">
audioPlayer();
var count = 0;
function audioPlayer() {
console.log('audio player');
// $('#audioPlayer')[0].src = $('#playlist li a')[0];
$('#playlist li a').click(function(e) {
e.preventDefault();
$('#audioPlayer')[0].src = this;
$('#audioPlayer')[0].play();
});
$('#play').click(function() {
console.log($('#link'));
if ($('#link')[0].value == "") {
alert('enter URL');
}
if ($('#link')[0].value != "" && count == 0) {
console.log("hello");
console.log($('#link')[0].value);
$('#playlist li a')[0].href = $('#link')[0].value;
var x = $('#playlist li a')[0].href
console.log(x);
$('#audioPlayer')[0].src = $('#playlist li a')[0];
$('#audioPlayer')[0].play();
var time1 = document.getElementById('audioPlayer');
console.log(time1.currentTime);
}
if (count > 0) {
$('#audioPlayer')[0].play();
var time1 = document.getElementById('audioPlayer');
console.log(time1.currentTime);
}
});
$('#pause').click(function() {
console.log('hello');
$("#audioPlayer")[0].pause();
console.log($('#audioPlayer')[0].paused);
count++;
});
$('#stop').click(function() {
location.reload();
})
}
</script>
</body>
</html>