audio: Use AudioBuffer's duration

This commit is contained in:
Hajime Hoshi 2016-02-10 01:04:15 +09:00
parent 719e5ba6d2
commit 14d28ea122

View File

@ -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 {