JavaScript30
JavaScript30 copied to clipboard
save video currenttime to local storage and get the time back when the page is reloaded also set video currenttime when you scrub the video.
What I did
1: I created a variable using let called currentVideoTime
like so

2: I am setting the video current time to local storage every time the togglePlay function is being clicked, so local storage always has the correct current time after a pause and a play is triggered, like so
3: I created a DOMContentLoaded event listener so when the page is reloaded, it saves and gets the current time and passes it to the video player, so with this the currentTime state is tracked on the fly, like so

4: I also set the video.current time when the video is also scrubbed, the scrub time will now be the new current time, like so