From 14d28ea12224dd7a3ec430541ac22d9ef03076b6 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Wed, 10 Feb 2016 01:04:15 +0900 Subject: [PATCH] audio: Use AudioBuffer's duration --- internal/audio/audio_js.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/internal/audio/audio_js.go b/internal/audio/audio_js.go index 819978916..9482cbe91 100644 --- a/internal/audio/audio_js.go +++ b/internal/audio/audio_js.go @@ -60,9 +60,8 @@ func (a *audioProcessor) playChunk(buf []byte) { s := context.Call("createBufferSource") s.Set("buffer", b) s.Call("connect", context.Get("destination")) - s.Call("start", a.position) - a.position += float64(len(il)) / float64(a.sampleRate) + a.position += b.Get("duration").Float() } func isPlaying(channel int) bool {