From 4c70ad382d93b28af7bf1e10702658e4bee6ea82 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sun, 24 Jun 2018 02:12:00 +0900 Subject: [PATCH] audio/mp3: Bug fix: Avoid using a detached ArrayBuffer --- audio/mp3/decode_js.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/audio/mp3/decode_js.go b/audio/mp3/decode_js.go index a88f0678c..0391d016c 100644 --- a/audio/mp3/decode_js.go +++ b/audio/mp3/decode_js.go @@ -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))