-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
32 lines (26 loc) · 945 Bytes
/
main.js
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
function upload(){
var input = document.createElement("INPUT");
input.type = "file";
input.accept = ".mp3";
input.click();
input.onchange = function(){
var song_name = this.files[0].name;
document.querySelector("#file-name").innerHTML = "song_name";
var url = URL.createObjectURL(this.files[0]);
var audio = document.createElement("AUDIO");
audio.src = url;
audio.play();
audio.onplay = function(){
document.querySelector("#play-pause").className = "fa fa-pause-circle";
document.querySelector("#play-pause").onclick = function(){
audio.pause();
}
}
audio.onpause = function(){
document.querySelector("#play-pause").className = "fa fa-play-circle";
document.querySelector("#play-pause").onclick = function(){
audio.play();
}
}
}
}