mirror of
https://github.com/jiojciojsioe3/a3cjroijsiojiorj.git
synced 2024-11-15 07:21:50 +08:00
SoundBuffer: Fix AudioContext on Safari again
This commit is contained in:
parent
c0db4119a9
commit
8565318c73
@ -3,7 +3,7 @@
|
|||||||
var AudioContext = window.AudioContext || window.webkitAudioContext
|
var AudioContext = window.AudioContext || window.webkitAudioContext
|
||||||
this.context = new AudioContext()
|
this.context = new AudioContext()
|
||||||
pageEvents.once(window, "click").then(() => {
|
pageEvents.once(window, "click").then(() => {
|
||||||
if(this.context.state == "suspended"){
|
if(this.context.state === "suspended"){
|
||||||
this.context.resume()
|
this.context.resume()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -12,7 +12,9 @@
|
|||||||
return loader.ajax(url, request => {
|
return loader.ajax(url, request => {
|
||||||
request.responseType = "arraybuffer"
|
request.responseType = "arraybuffer"
|
||||||
}).then(response => {
|
}).then(response => {
|
||||||
return this.context.decodeAudioData(response)
|
return new Promise((resolve, reject) => {
|
||||||
|
return this.context.decodeAudioData(response, resolve, reject)
|
||||||
|
})
|
||||||
}).then(buffer => {
|
}).then(buffer => {
|
||||||
return new Sound(gain || {soundBuffer: this}, buffer)
|
return new Sound(gain || {soundBuffer: this}, buffer)
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user