From 9c15e0006683dc66b6ef99e4c894902310010090 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Carlos=20Cuevas?= Date: Fri, 15 Nov 2024 01:47:40 +0100 Subject: [PATCH] Updated to the latest radiospiral server --- main.go | 12 ++++++++++-- radioplayer.go | 5 +++++ 2 files changed, 15 insertions(+), 2 deletions(-) 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 {