File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -54,9 +54,12 @@ var LibraryWebAudio = {
54
54
// this avoids the user needing to manually add the dependency on the command line.
55
55
emscripten_create_audio_context__deps : [ '$emscriptenRegisterAudioObject' , '$emscriptenGetAudioObject' ] ,
56
56
emscripten_create_audio_context : ( options ) => {
57
+ // Safari added unprefixed AudioContext support in Safari 14.5 on iOS: https://caniuse.com/audio-api
58
+ #if MIN_SAFARI_VERSION < 140500 || ENVIRONMENT_MAY_BE_NODE || ENVIRONMENT_MAY_BE_SHELL
57
59
var ctx = window . AudioContext || window . webkitAudioContext ;
58
60
#if ASSERTIONS
59
61
if ( ! ctx ) console . error ( 'emscripten_create_audio_context failed! Web Audio is not supported.' ) ;
62
+ #endif
60
63
#endif
61
64
62
65
var opts = options ? {
@@ -69,7 +72,12 @@ var LibraryWebAudio = {
69
72
console . dir ( opts ) ;
70
73
#endif
71
74
75
+ #if MIN_SAFARI_VERSION < 140500 || ENVIRONMENT_MAY_BE_NODE || ENVIRONMENT_MAY_BE_SHELL
72
76
return ctx && emscriptenRegisterAudioObject ( new ctx ( opts ) ) ;
77
+ #else
78
+ // We are targeting an environment where we can assume that new AudioContext() will unconditionally succeed.
79
+ return emscriptenRegisterAudioObject ( new AudioContext ( opts ) ) ;
80
+ #endif
73
81
} ,
74
82
75
83
emscripten_resume_audio_context_async : ( contextHandle , callback , userData ) => {
You can’t perform that action at this time.
0 commit comments