#126: Fix the bug crashing on Safari

This commit is contained in:
Hajime Hoshi 2015-06-04 01:25:04 +09:00
parent 7490bfa4f4
commit 115c97f296

View File

@ -57,7 +57,14 @@ func initialize() {
return return
} }
context = js.Global.Get("AudioContext").New() class := js.Global.Get("AudioContext")
if class == js.Undefined {
class = js.Global.Get("webkitAudioContext")
}
if class == js.Undefined {
return
}
context = class.New()
// TODO: ScriptProcessorNode will be replaced with Audio WebWorker. // TODO: ScriptProcessorNode will be replaced with Audio WebWorker.
// https://developer.mozilla.org/ja/docs/Web/API/ScriptProcessorNode // https://developer.mozilla.org/ja/docs/Web/API/ScriptProcessorNode
for i := 0; i < MaxChannel; i++ { for i := 0; i < MaxChannel; i++ {