Skip to content

Commit

Permalink
Fix disconnection
Browse files Browse the repository at this point in the history
  • Loading branch information
ebma committed Sep 9, 2023
1 parent 386e5b5 commit 7e8fb80
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
12 changes: 8 additions & 4 deletions src/libs/StreamManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,17 @@ class StreamManager {
constructor(voiceConnection: VoiceConnection) {
this.voiceConnection = voiceConnection
this.subject = new Subject()
this.player = createAudioPlayer({
this.player = this.createPlayer()
this.voiceConnection.subscribe(this.player)
}

private createPlayer() {
return createAudioPlayer({
behaviors: {
noSubscriber: NoSubscriberBehavior.Stop,
maxMissedFrames: Math.round(5000 / 20),
},
}
})
this.voiceConnection.subscribe(this.player)
}

setVolume(volume: number) {
Expand Down Expand Up @@ -254,7 +258,7 @@ class StreamManager {

disconnect() {
this.stop()
this.player = null
this.player = this.createPlayer()
this.voiceConnection.disconnect()
}
}
Expand Down
8 changes: 0 additions & 8 deletions web/src/components/Dashboard/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,6 @@ function Dashboard(props: Props) {
const player = playerQuery.data?.getPlayer || null
const available = player?.available || false

// const navigate = useNavigate()
//
// React.useEffect(() => {
// if (!history.location.hash) {
// navigate("/home")
// }
// }, [history])

return (
<div className={classes.root}>
<CssBaseline />
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/Waves/Waves.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,4 +162,4 @@ function Waves(props: Props) {
</motion.div>
)
}
export default React.memo(Waves)
export default Waves

0 comments on commit 7e8fb80

Please sign in to comment.