Autoplay Audio is slow

Hey everyone. I just wanted to jump in and clear up the way audio works at present on Wanikani to hopefully help you understand the reasons it works the way it does and the design decisions I made when updating the audio.

Historically we used a library called Howler to play the audio, but we had quite a lot reported audio issues some of which remained unresolved. When I updated the lesson and reviews at the beginning of the year I decided to simplify the audio code to use plain old HTML5 audio elements everywhere in order to reduce the number of reported bugs. We already used HTML5 audio on the item pages, and the lesson slides aren’t any different so they got updated to match. On the item pages and the lesson slides there is an HTML5 audio element for each voice actor and corresponding reading. The browser will take care of preloading that audio, and different browsers will do this different ways depending on environmental factors (e.g. a mobile device in low power mode will not generally load the audio until there is an explicit user interaction to play it). This should hopefully explain why you see what you see in the network tab on lesson and item pages.

As for quizzes (reviews, lesson quiz, and extra study) I only load the audio after you have answered the question. The reason for this is the audio that is loaded is dependant on the answer that you give. An item may have more than one possible reading each with its own audio pronunciation and we only play the audio of the matching answer as it would be weird to do otherwise. It seemed wasteful (especially for users on mobile networks) to preload all the possible audio when only a fraction of it would be used. This is why you see what you see on the network tab for quizzes.

I thought that as we use a CDN to deliver all the audio, and the CDN is configured to keep the audio as close to the end user as possible, that latency would not be an issue. This is something we will keep an eye on, and your feed back has been noted. Like @WaniConti said, if anyone else has this issue please do send an email so we can get a sense of how large of an issue this latency is.

While this info doesn’t solve your latency issues, hopefully it gives you insight into why it is the way it is currently.

6 Likes