fix player null on volume/mute change
This commit is contained in:
parent
dff4ecc42c
commit
8b36d79420
8
radio.js
8
radio.js
|
@ -109,7 +109,7 @@ function startStation(new_station) {
|
||||||
setVisualizer(tuner.analysers, visualizer.mode);
|
setVisualizer(tuner.analysers, visualizer.mode);
|
||||||
|
|
||||||
// Properly set volume value.
|
// Properly set volume value.
|
||||||
tuner.player.audioElement.volume = tuner.volume/100;
|
if (!tuner.isMuted) tuner.player.audioElement.volume = tuner.volume/100;
|
||||||
play();
|
play();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,19 +144,19 @@ function mute() {
|
||||||
if (tuner.isMuted) {
|
if (tuner.isMuted) {
|
||||||
document.querySelector('.volume').classList.remove('active');
|
document.querySelector('.volume').classList.remove('active');
|
||||||
document.querySelector('.volslider').title = tuner.volume+'%';
|
document.querySelector('.volslider').title = tuner.volume+'%';
|
||||||
tuner.player.audioElement.volume=tuner.volume/100;
|
if (tuner.player) tuner.player.audioElement.volume=tuner.volume/100;
|
||||||
} else {
|
} else {
|
||||||
document.querySelector('.volume').classList.add('active');
|
document.querySelector('.volume').classList.add('active');
|
||||||
document.querySelector('.volslider').title = "Muted";
|
document.querySelector('.volslider').title = "Muted";
|
||||||
tuner.player.audioElement.volume=0;
|
if (tuner.player) tuner.player.audioElement.volume=0;
|
||||||
}
|
}
|
||||||
tuner.isMuted = !tuner.isMuted;
|
tuner.isMuted = !tuner.isMuted;
|
||||||
}
|
}
|
||||||
|
|
||||||
function volChange(e) {
|
function volChange(e) {
|
||||||
tuner.player.audioElement.volume=e.value/100;
|
|
||||||
e.parentNode.title = e.value+'%';
|
e.parentNode.title = e.value+'%';
|
||||||
tuner.volume = e.value;
|
tuner.volume = e.value;
|
||||||
|
if (tuner.player) tuner.player.audioElement.volume=e.value/100;
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateMetadata(track) {
|
function updateMetadata(track) {
|
||||||
|
|
Reference in New Issue
Block a user