Closed KatieWoe closed 3 years ago
Never mind. It looks like Safari needed an update. Safari is now on 14.1.2 and the sims seem to load now.
I am, however, seeing it in macOS 10.13 Safari 13. I was not seeing it yesterday when looking at master.
I've done some investigation and worked with @KatieWoe to test out several permutations of the sound file code, and I know what's up. In #151 it was reported that sims aren't loading if decoding of sounds is failing. I added code to handle both of the errors that were appearing in the console, one that was a result of trying to create a zero-length audio buffer, and one about an unhandled promise rejection, since it seemed prudent to handle everything. However, according to https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext/decodeAudioData, decodeAudioData
didn't always return a Promise
, so the promise-error-handling code is now failing on older versions of Safari. Nice.
During @KatieWoe and my testing, I found that sims still load if the promise rejection is unhandled, so we have two options (that I can think of) here:
catch
block in the sound files.There are tradeoffs with both of these. I'll discuss with @jonathanolson and we will decide which way to go.
In this issue, I see a problem report, followed by hundreds of commits, to many repos, all linked to this issue and #151. A summary of what the probem was, how it was addressed, whether it's a permanent fix or workaround, etc. seems like something that should be added here before this issue is closed.
See https://github.com/phetsims/qa/issues/718#issuecomment-941555189 for @jbphet's summary of the additional sound problem that was discovered, resulting in another MR.
To summarize this particular issue, the problem was that the latest version of the Web Audio API returns a Promise when decoding audio buffers, but older versions do not. In my first attempt to improve the error handling code for failures of audio decode, I added a catch call to this Promise, and this failed on Safari 13. The code has now been modified to only add the catch if something is returned by the call to decodeAudio
, and the QA team has verified that this works.
I've completed the maintenance release, so I believe this is now fully deployed. Closing.
For https://github.com/phetsims/qa/issues/713. The sims are failing to load with the error shown bellow in MacOS 10.14 Safari 14. They are loading in published.