-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplayer.html
83 lines (66 loc) · 2.88 KB
/
player.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
<header id="about">
<div id="main">
<div id="image">
<img src="/images/J&G Logo.png">
</div>
<div id="player">
<div output="" id="songTitle">I'm On My Way</div>
<div id="buttons">
<button id="pre" onclick="pre()"><</button>
<button id="play" onclick="playOrPauseSong()">PLAY</button>
<button id="next" onclick="next()">></button>
</div>
</div>
<progress id="seekbar" value="0.05109950165338493" max="1" style="width:200px;"></progress>
</div>
<script type="text/javascript">
var songs = ["https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3", "https://www.soundhelix.com/examples/mp3/SoundHelix-Song-2.mp3", "https://www.soundhelix.com/examples/mp3/SoundHelix-Song-3.mp3", "https://www.soundhelix.com/examples/mp3/SoundHelix-Song-4.mp3", "https://www.soundhelix.com/examples/mp3/SoundHelix-Song-5.mp3", "https://www.soundhelix.com/examples/mp3/SoundHelix-Song-6.mp3", "https://www.soundhelix.com/examples/mp3/SoundHelix-Song-7.mp3"];
var poster = ["/images/J&G Logo.png", "/images/J&G Logo.png", "/images/J&G Logo.png", "/images/J&G Logo.png", "/images/J&G Logo.png", "/images/J&G Logo.png", "/images/J&G Logo.png"];
var titles = ["I'm On My Way", "Rolling In The Deep", "Mad World", "Too Close", "Feelin' Good", "I Will Wait", "All These Things That I've Done"]
var songTitle = document.getElementById("songTitle");
var fillBar = document.getElementById("fill");
var song = new Audio();
var currentSong = 0;
songTitle.textContent = titles[currentSong];
function playSong(){
song.src = songs[currentSong];
songTitle.textContent = titles[currentSong];
song.play();
}
function playOrPauseSong(){
if(song.paused){
playSong();
$("#play img").attr("src","/images/Pause.png");
}
else{
song.pause();
$("#play img").attr("src","/Images/Play.png");
}
}
song.addEventListener('timeupdate',function(){
$('#seekbar').attr("value", this.currentTime / this.duration);
});
function next(){
currentSong++;
if(currentSong > songs.length - 1){
currentSong = 0;
}
playSong();
$("#play img").attr("src","/images/Pause.png");
$("#image img").attr("src",poster[currentSong]);
$("#bg img").attr("src",poster[currentSong]);
}
function pre(){
currentSong--;
if(currentSong < 0){
currentSong = songs.length - 1;
}
playSong();
$("#play img").attr("src","/images/Pause.png");
$("#image img").attr("src",poster[currentSong]);
$("#bg img").attr("src",poster[currentSong]);
}
function countProgress(event) {
}
</script>
</header>