Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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. #521

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

akinsikuoluwafemi
Copy link

What I did

1: I created a variable using let called currentVideoTime
like so
Screenshot 2022-06-22 at 14 37 55

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

Screenshot 2022-06-22 at 14 38 50

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
Screenshot 2022-06-22 at 14 41 32

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

Screenshot 2022-06-22 at 14 45 41

…e page is reloaded also set video currenttime when you scrub the video
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant