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

Subtitles are not updated in PAUSE mode #15

Open
arcadeus opened this issue Apr 20, 2021 · 3 comments
Open

Subtitles are not updated in PAUSE mode #15

arcadeus opened this issue Apr 20, 2021 · 3 comments

Comments

@arcadeus
Copy link

Stop YouTube video and forward it by the Right Arrow on the keyboard.
Subtitles are not updated.

@siloor
Copy link
Owner

siloor commented Apr 28, 2021

Hello @arcadeus !

Thanks for noticing the error, it really does exist.

However I'm not sure if I can fix it. The problem is, that the YouTube Iframe Api doesn't have an event for seeking, it only has events for playing, stopping and buffering. Now it works like the following: when the play event is triggered, the script starts an interval check (it runs every 500 milliseconds) and gets the current time from the api. And when the stop event occures, the script cleares the interval.

We could do the same thing and run the current time check even in the stopped state. But I think that would be a bit too much. Imagine, that there 50 embedded videos on a page. Now it only checks the time and renders the subtitle on the video which is currently playing (usually I think a person used to watch only one video at a time). Otherwise it would check all the videos constantly of course and most of the time there wouldn't be any change at all. Only in this case, when the video is paused and someone presses an arrow or seeks with the mouse.

My opinion is, that this is something we can live with, and I think the script shouldn't do anything until the video is not playing.

What do you think, should we fix this? I would appreciate hearing your thoughts about the issue!

@Esn024
Copy link

Esn024 commented May 14, 2021

"Now it works like the following: when the play event is triggered, the script starts an interval check (it runs every 500 milliseconds) and gets the current time from the api. And when the stop event occures, the script cleares the interval."

Could you please point out the lines in the code (in "docs/static/vendor/youtube.external.subtitle.js") where those things are done? I'm trying to understand how it works. There's a lot of stuff here I don't understand yet, but I'm hoping to understand enough...

@arcadeus
Copy link
Author

Hello @siloor !
I think that the best solution is:

  • add a boolean option workInPause (default: false),
  • don't stop the timer when workInPause is true,
  • warn users about performance drawbacks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants