20/12/2023
2023/12/20#p2
I realised there was a fundamental flaw with my podcasts view for /reader: tracking progress.
If I were to close the browser or refresh the page each audio tag would reset to 0 and I'd have to seek through until I found where I was.
Not any more...
Various attributes of the audio tag are accessible via script including, importantly, currentTime
.
The page, like /reader itself, is public so I run a check to see if I'm logged in. If so, a script will periodically (every 10 seconds) check the value of currentTime and, if it has changed, write that to the database entry for that item.
Likewise, if logged in, I check against the database for the last recorded time and set that on page load. This means I will only ever be a maximum of 10 seconds out should I accidentally close the browser or navigate away.