Pārlūkot izejas kodu

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

Ivan Asmer 4 gadi atpakaļ
vecāks
revīzija
a64a244d88
1 mainītis faili ar 4 papildinājumiem un 1 dzēšanām
  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)