diff --git a/src/client/classes/Streamer.js b/src/client/classes/Streamer.js index f70ab00..9ab69f8 100644 --- a/src/client/classes/Streamer.js +++ b/src/client/classes/Streamer.js @@ -49,12 +49,22 @@ module.exports = class { play(station) { let audioPlayer = this.map.get(station.name); if(!audioPlayer) { - audioPlayer = createAudioPlayer({ - behaviors: { - noSubscriber: NoSubscriberBehavior.Play, - maxMissedFrames: Math.round(5000 / 20), - }, - }); + if(this.mode == "auto"){ + audioPlayer = createAudioPlayer({ + behaviors: { + noSubscriber: NoSubscriberBehavior.Play, + maxMissedFrames: Math.round(5000 / 20), + }, + }); + } + if(this.mode == "manual"){ + audioPlayer = createAudioPlayer({ + behaviors: { + noSubscriber: NoSubscriberBehavior.Stop, + maxMissedFrames: Math.round(5000 / 20), + }, + }); + } this.map.set(station.name, audioPlayer); } const url = station.stream[station.stream.default]; @@ -77,22 +87,18 @@ module.exports = class { }) .on('idle', () => { this.logger('Streamer', station.name + " / " + "Idle"); - this.play(station); }) .on('paused', () => { this.logger('Streamer', station.name + " / " + "Paused"); - this.play(station); }) .on('buffering', () => { this.logger('Streamer', station.name + " / " + "Buffering"); }) .on('autopaused', () => { this.logger('Streamer', station.name + " / " + "AutoPaused"); - this.play(station); }) .on('error', error => { this.logger('Streamer', station.name + " / " + "Error" + "\n" + error); - this.play(station); }); return audioPlayer; }