Browse Source

+timecodes in markdown for current playing video -2 seconds for user lag

Ivan Asmer 4 years ago
parent
commit
a64a244d88
1 changed files with 4 additions and 1 deletions
  1. 4 1
      src/App.js

+ 4 - 1
src/App.js

@@ -416,7 +416,10 @@ const MDEdit = ({children, field, onChange, ...props}) => {
                                 const videos = [...document.querySelectorAll('video')]
                                 const playing = videos.find(v => v.playing)
                                 if (playing){
-                                    const {currentTime} = playing
+                                    let {currentTime} = playing
+                                    currentTime -=2
+                                    currentTime = currentTime < 0 ? 0 : currentTime
+
                                     const ast =  buildAST(children)
                                     let timeCodes = getTimeCodes(ast)
                                     console.log(currentTime, timeCodes)