Updated to the latest radiospiral server

This commit is contained in:
José Carlos Cuevas 2024-11-15 01:47:40 +01:00
parent 17a5df5959
commit 9c15e00066
2 changed files with 15 additions and 2 deletions

12
main.go
View file

@ -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,

View file

@ -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 {