mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2024-11-09 23:00:18 +00:00
Create event listeners once in Streamer class
This commit is contained in:
parent
408c5aaab8
commit
2579549f0b
@ -64,6 +64,23 @@ export default class Streamer {
|
||||
});
|
||||
}
|
||||
|
||||
audioPlayer
|
||||
.on(AudioPlayerStatus.Playing, () => {
|
||||
logger('Streamer', station.name + " / " + "Playing");
|
||||
})
|
||||
.on(AudioPlayerStatus.Idle, () => {
|
||||
logger('Streamer', station.name + " / " + "Idle");
|
||||
})
|
||||
.on(AudioPlayerStatus.Paused, () => {
|
||||
logger('Streamer', station.name + " / " + "Paused");
|
||||
})
|
||||
.on(AudioPlayerStatus.Buffering, () => {
|
||||
logger('Streamer', station.name + " / " + "Buffering");
|
||||
})
|
||||
.on(AudioPlayerStatus.AutoPaused, () => {
|
||||
logger('Streamer', station.name + " / " + "AutoPaused");
|
||||
})
|
||||
|
||||
this.map.set(station.name, audioPlayer);
|
||||
}
|
||||
|
||||
@ -71,22 +88,6 @@ export default class Streamer {
|
||||
const resource = createAudioResource(url);
|
||||
audioPlayer.play(resource);
|
||||
|
||||
audioPlayer
|
||||
.on(AudioPlayerStatus.Playing, () => {
|
||||
logger('Streamer', station.name + " / " + "Playing");
|
||||
})
|
||||
.on(AudioPlayerStatus.Idle, () => {
|
||||
logger('Streamer', station.name + " / " + "Idle");
|
||||
})
|
||||
.on(AudioPlayerStatus.Paused, () => {
|
||||
logger('Streamer', station.name + " / " + "Paused");
|
||||
})
|
||||
.on(AudioPlayerStatus.Buffering, () => {
|
||||
logger('Streamer', station.name + " / " + "Buffering");
|
||||
})
|
||||
.on(AudioPlayerStatus.AutoPaused, () => {
|
||||
logger('Streamer', station.name + " / " + "AutoPaused");
|
||||
})
|
||||
return audioPlayer;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user