Open gkatsev opened 9 years ago
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 setTimeout(fn, 0)
around some of the bulky operations?
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.