You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-06 12:20:30 +00:00
[HTML5] Catch audio worklet errors on disconnect.
Which could happen if the worklet was not fully loaded, or the audio context had already aborted.
This commit is contained in:
@@ -238,6 +238,9 @@ const GodotAudioWorklet = {
|
|||||||
|
|
||||||
close: function () {
|
close: function () {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
|
if (GodotAudioWorklet.promise === null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
GodotAudioWorklet.promise.then(function () {
|
GodotAudioWorklet.promise.then(function () {
|
||||||
GodotAudioWorklet.worklet.port.postMessage({
|
GodotAudioWorklet.worklet.port.postMessage({
|
||||||
'cmd': 'stop',
|
'cmd': 'stop',
|
||||||
@@ -247,7 +250,7 @@ const GodotAudioWorklet = {
|
|||||||
GodotAudioWorklet.worklet = null;
|
GodotAudioWorklet.worklet = null;
|
||||||
GodotAudioWorklet.promise = null;
|
GodotAudioWorklet.promise = null;
|
||||||
resolve();
|
resolve();
|
||||||
});
|
}).catch(function (err) { /* aborted? */ });
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user