diff --git a/main.go b/main.go index d06d837..6fedabc 100644 --- a/main.go +++ b/main.go @@ -59,7 +59,7 @@ import ( ) // Enums and constants -const RADIOSPIRAL_STREAM = "https://radiospiral.radio/stream.mp3" +const RADIOSPIRAL_STREAM = "https://radiospiral.radio:8000/stream.mp3" const RADIOSPIRAL_JSON_ENDPOINT = "https://radiospiral.net/wp-json/radio/broadcast" const ( @@ -191,8 +191,16 @@ func main() { volumeUp := widget.NewButtonWithIcon("", theme.VolumeUpIcon(), func() { streamPlayer.IncVolume() }) - volumeMute := widget.NewButtonWithIcon("", theme.VolumeMuteIcon(), func() { + + var volumeMute *widget.Button + + volumeMute = widget.NewButtonWithIcon("", theme.VolumeMuteIcon(), func() { streamPlayer.Mute() + if streamPlayer.IsMuted() { + volumeMute.SetText("x") + } else { + volumeMute.SetText("") + } }) controlContainer := container.NewHBox( nowPlayingLabelHeader, diff --git a/radioplayer.go b/radioplayer.go index 0b9c769..4758c17 100644 --- a/radioplayer.go +++ b/radioplayer.go @@ -36,6 +36,7 @@ import ( type RadioPlayer interface { Load(stream_url string) IsPlaying() bool + IsMuted() bool Play() Mute() Stop() @@ -144,6 +145,10 @@ func (player *StreamPlayer) Close() { } } +func (player *StreamPlayer) IsMuted() bool { + return player.otoPlayer.Volume() == 0.0 +} + func (player *StreamPlayer) Mute() { if player.IsPlaying() { if player.otoPlayer.Volume() > 0 {