fixed newplayer func
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -1 +1 @@
|
||||
5fbf12469d224a93954efecb5886e8a6
|
||||
6cdae3f6b1951ca1bf1d6febf086be53
|
||||
+1
-1
@@ -7,4 +7,4 @@ export function ChangeState(arg1:player.PlayerState):Promise<void>;
|
||||
|
||||
export function Init(arg1:context.Context):Promise<void>;
|
||||
|
||||
export function Play():Promise<void>;
|
||||
export function Play(arg1:string):Promise<void>;
|
||||
|
||||
@@ -10,6 +10,6 @@ export function Init(arg1) {
|
||||
return window['go']['player']['Player']['Init'](arg1);
|
||||
}
|
||||
|
||||
export function Play() {
|
||||
return window['go']['player']['Player']['Play']();
|
||||
export function Play(arg1) {
|
||||
return window['go']['player']['Player']['Play'](arg1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user