aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2023-06-30 17:05:27 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2023-06-30 18:09:46 +0200
commit1da552c5e9c0a110056537647b325e1107d8a6bb (patch)
tree0efa0ee38a83b841a2acbe8194b868ff54b5429c
parent51dbf50634fd3fd82f71cb1c64e0569c217828ae (diff)
downloadWRMS-1da552c5e9c0a110056537647b325e1107d8a6bb.tar.gz
WRMS-1da552c5e9c0a110056537647b325e1107d8a6bb.zip
fix toggling of playing state in wrms.PlayPause
-rw-r--r--wrms.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/wrms.go b/wrms.go
index 8b292c8..5b7fcf3 100644
--- a/wrms.go
+++ b/wrms.go
@@ -339,17 +339,17 @@ func (wrms *Wrms) _next() {
func (wrms *Wrms) PlayPause() {
wrms.rwlock.Lock()
// Toggle the playback state
- defer func() { wrms.Playing = !wrms.Playing }()
+ wrms.Playing = !wrms.Playing
- // Wrms is playing -> pause the player
- if wrms.Playing {
+ // Wrms was playing -> pause the player
+ if !wrms.Playing {
wrms.Player.Pause()
wrms.rwlock.Unlock()
wrms.Broadcast(newNotification("pause"))
return
}
- // Wrms is not playing
+ // Wrms was not playing
currentSong := wrms.CurrentSong.Load()
// Wrms has no current song -> try to play the next song