audio/mp3: Bug fix: Avoid using a detached ArrayBuffer

This commit is contained in:
Hajime Hoshi 2018-06-24 02:12:00 +09:00
parent 8c9a11ddf4
commit 4c70ad382d

View File

@ -186,7 +186,7 @@ func decode(context *audio.Context, buf []byte, try int) (*Stream, error) {
// TODO: 1 is a correct second argument?
oc := offlineAudioContextClass.New(2, 1, context.SampleRate())
a := js.ValueOf(buf).Get("buffer")
a := js.ValueOf(buf).Get("buffer").Call("slice", 0, len(buf))
oc.Call("decodeAudioData", a, js.NewCallback(func(args []js.Value) {
buf := args[0]
s.leftData = float32ArrayToSlice(buf.Call("getChannelData", 0))