-
Notifications
You must be signed in to change notification settings - Fork 94
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
vttjs takes a long time (1s) to parse really long files, isn't optimized by engines #340
Comments
FYI, the video won't work in the linked jsbin because flash isn't supported there, you need to go to the preview version o the bin. http://output.jsbin.com/kopuqizomo/1 @gkatsev the captions don't show at all in those examples. Is that expected? I definitely see the drag though, in Chrome and Safari. What do you mean by chunk processing, specifically? Just dropping a |
They start at around 27 seconds. Basically, process a bit of the file at a time. Around 100-200ms at a time or maybe like 30 cues. And wrap each chunk in a setTimeout. |
@RickEyre any thoughts on this? Thanks! |
hi guys, any updates/workarounds about this? |
If you use a really large webvtt file (like here http://jsbin.com/hewamuwali/1/edit?html,output, with 1553 cues), vttjs takes around 1 second to parse the file.
One of the reasons is that the parse function uses a lot of try/catches and some engines (for example, v8) do not optimize these functions, so, they never run as fast as possible.
Also, this function runs synchronously rather than asynchronously. This means that if it takes a long time to parse the file, everything else in the application will hang.
The parse function should be broken up to chunk processing of the file asynchronously to hand back execution time to the page. Also, try/catches should either be wrapped or removed altogether.
The text was updated successfully, but these errors were encountered: