-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
74 lines (56 loc) · 2.17 KB
/
script.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
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
var radio = document.getElementById("rad");
var cover = document.getElementById("albumCover");
var rn=document.getElementById('radText');
var songs = [
'http://rfcmedia.streamguys1.com/MusicPulse.mp3',//internation hitz
'http://streams.bigfm.de/bigfm-nitroxedm-128-mp3?usid=0-0-H-A-D-02',//EDM
'http://51.15.208.163:8081/radio/mt20live_11/icecast.audio',//R MIRCHI
'http://185.52.127.159/de/33019/mp3_128.mp3',//ALAN WALKWER
'http://media-ice.musicradio.com/HeartLondonMP3'//Love FM
];
var poster = ["https://images.music-worx.com/covers/Hello-Hiren-Whyte-Label-musicworx.jpg",
"http://lh3.googleusercontent.com/y4B_SVLZplALZ474KKsVCrqL3ACE_5bSrm7tH3lEjhIGSpv47vWRTN9GcN6NxlbbLA=w300",
"http://www.indiantelevision.com/sites/default/files/styles/smartcrop_800x800/public/images/tv-images/2016/05/12/Radio%20Mirchi.jpg?itok=d-QBu3Ee",
"http://buystreamspot.com/wp-content/uploads/2018/05/07.jpg",
"https://pbs.twimg.com/media/Dp9jBWKWkAEtNyr.jpg"
];
var title =['Today\'s HitZ','Nitro EDM','Radio MIRCHI','Alan Walker','Love Radio' ];
$(document).on('click', '.fa-play', function(e){
$(e.target).addClass("fa-pause");
$(e.target).removeClass("fa-play");
});
$(document).on('click', '.fa-pause', function(e){
$(e.target).addClass("fa-play");
$(e.target).removeClass("fa-pause");
});
var song = new Audio();
var currentSong = 0;
function playSong(){
if(song.paused){
song.src = songs[currentSong];
song.play();// play the song
}
else{
song.pause();
}
}
function next(){
if(currentSong==4){
currentSong=-1;
}
currentSong++;
song.src=songs[currentSong];
rn.textContent=title[currentSong];
cover.src=poster[currentSong];
song.play();
}
function prev(){
if(currentSong==0){
currentSong=5;
}
currentSong--;
song.src=songs[currentSong];
rn.textContent=title[currentSong];
cover.src=poster[currentSong];
song.play();
}