Audio Player Logic – Fyne Golang GUI tutorial 66
Audio Player Logic – Fyne Golang GUI tutorial 66
Source Code
package main import ( "os" "time" "github.com/faiface/beep/mp3" "github.com/faiface/beep/speaker" ) func main() { // open file // underscore mean we are ignoring error f, _ := os.Open("hen.mp3") // decoding mp3 file // 3 outputs // stream , format and error streamer, format, _ := mp3.Decode(f) // activate speakers speaker.Init(format.SampleRate, format.SampleRate.N(time.Second/10)) // play speaker.Play(streamer) // looping select {} }Download Code