ArchiveLabs / audiobooks

Listen to millions of free books, read aloud by robot voices
GNU Affero General Public License v3.0
26 stars 5 forks source link

Event driven code crashes often #3

Open mc2 opened 6 years ago

mc2 commented 6 years ago

The design of the event code (buttons, reader events) is pretty fragile in two ways: 1) could be better designed, 2) browser reader events (if I remember correctly) can fail.

To reproduce one bug: go to a page with a lot of text. Click Play. Then click "Pause" "Resume" "Pause" "Resume" until it fails.

I tried a number of different ways of coding/detecting events. The various browser's implementations of the readers is (if I remember correctly,) very wonky. Tried to be defensive, but needs a new hard look if this is to ship to people-who-happen-to-not-be-developers.

mekarpeles commented 6 years ago

I think I've addressed a handful of these cases in https://archive.org/~mek/audioreader.php -- the code needs to be merged.

The event capturing was very challenging to work with because so many states were introduced. I think in total there only really needs to be ~4 states, all represented by a single variable (rather than action, app action, synth action, etc)

mekarpeles commented 6 years ago

Code can be tested here: https://archive.org/~mek/audioreader/?ocaid=adventuresofbobw00burg&page=29