Hanziness / FocusTide

Modern and customizable productivity timer app that runs in your browser.
https://focustide.app
MIT License
321 stars 35 forks source link

Delay loading of audio until timer has been started #28

Closed Hanziness closed 3 years ago

Hanziness commented 3 years ago

Due to a (not so recent) change in Chromium, pages are not allowed to start an AudioContext until the user has interacted with them. At the moment, the application loads all audio files on startup and HowlerJS also starts an audio context along with them, potentially slowing down the page load and unnecessarily downloading audio files that may not be used at all.

A better solution would be to only load the audio files (and howler, too!) when the timer is started for the first time or when the timer nearly runs out. This can help reduce stress on the initially required bandwidth and also potentially help Webpack move HowlerJS into a separate chunk.

Hanziness commented 3 years ago

Since HowlerJS has been removed, no warnings are present in Chromium, but the loading of audio files will still need to be delayed (currently they are all downloaded when the notification handler initializes, adding about 80 KiB to the initial bandwidth usage).