fixed newplayer func

This commit is contained in:
2025-03-25 14:55:03 -04:00
parent 85e64a7037
commit 53c6bce3dd
4 changed files with 6 additions and 10 deletions
+2 -6
View File
@@ -27,11 +27,11 @@ const (
Stopped
)
func NewPlayer() *Player {
func NewPlayer() (*Player, error) {
return &Player{
// TODO: variable speaker sample rates
sampleRate: beep.SampleRate(44100),
}
}, nil
}
func (p *Player) Init(ctx context.Context) {
@@ -51,10 +51,6 @@ func (p *Player) Play(filePath string) error {
return fmt.Errorf("failed to open file %w", err)
}
if p.streamer == nil || p.format == nil {
}
streamer, format, err := mp3.Decode(f)
if err != nil {
return fmt.Errorf("failed to decode mp3 %w", err)