-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathradio-js.js
42 lines (38 loc) · 1.09 KB
/
radio-js.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
jQuery(document).ready(function($) {
var radio = document.getElementById('radio_player');
var play = $('#radio_play');
var mute = $('#radio_mute');
var volb = $('#radio_volume');
if (radio)
radio.volume = volb.val();
$('#radio_stations').change(function() {
var src = $("select option:selected").attr('value');
$('#radio_player').attr('src', src);
radio.play();
} );
/*
* //TODO maybe check if radio is playing and if yes,
* then on change play station, otherwise let the user do it.
*/
play.click(function() {
if ( radio.paused ) {
radio.play();
play.text("Pause");
} else {
radio.pause();
play.text("Play");
}
});
mute.click(function() {
if ( radio.muted ) {
radio.muted = false;
mute.text("Mute");
} else {
radio.muted = true;
mute.text("Muted");
}
});
volb.change(function() {
radio.volume = volb.val();
});
});