From cc51bc2a088f7b2010c52af864104e1fc7dc835b Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Mon, 4 Apr 2016 02:54:54 +0900 Subject: [PATCH] audio: Sleep 1 msec instead of calling Gosched in JavaScript --- exp/audio/audio_js.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exp/audio/audio_js.go b/exp/audio/audio_js.go index 9ed606e92..ae8f5ba0f 100644 --- a/exp/audio/audio_js.go +++ b/exp/audio/audio_js.go @@ -19,7 +19,7 @@ package audio import ( "errors" "io" - "runtime" + "time" "github.com/gopherjs/gopherjs/js" "github.com/hajimehoshi/ebiten" @@ -64,7 +64,7 @@ func startPlaying(src io.Reader, sampleRate int) error { // TODO: Record the last error panic(err) } - runtime.Gosched() + time.Sleep(1 * time.Millisecond) } }() return nil