wwwtyro / keyzen

A touch typing trainer geared towards programmers and others that need to practice with all the symbols on the keyboard.
194 stars 139 forks source link

Use Web Audio API to instantiate samples once and play performantly #19

Closed morgant closed 2 years ago

morgant commented 2 years ago

The current Audio media element sound playback implementation causes major performance issues on iOS/iPadOS (see Issue #18). This PR migrates sound playback to the newer Web Audio API, resolving the playback & performance issues on iOS, and should be much more efficient on all platforms as the .wav files are only loaded once.

Note: It does require newer browser versions (though the Web Audio API has been around for a while now) and breaks audio when loaded via file:/// URI due to CORS errors.

morgant commented 2 years ago

No complaints and it's working well for me, so merged.