audio: Bug fix: newPlayer should return error in JS

This commit is contained in:
Hajime Hoshi 2016-02-13 21:39:45 +09:00
parent 72e0080f65
commit 797bd04b1f

View File

@ -49,7 +49,7 @@ func initialize() bool {
return true
}
func newPlayer(src io.ReadSeeker, sampleRate int) *Player {
func newPlayer(src io.ReadSeeker, sampleRate int) (*Player, error) {
if context == nil {
if !initialize() {
panic("audio couldn't be initialized")
@ -62,7 +62,7 @@ func newPlayer(src io.ReadSeeker, sampleRate int) *Player {
position: context.Get("currentTime").Float(),
bufferSource: nil,
}
return &Player{p}
return &Player{p}, nil
}
func toLR(data []byte) ([]int16, []int16) {