| 31 | return percent; |
| 32 | } |
| 33 | function progessTimeline(segments: Segment[], player: any) { |
| 34 | const progressEles: NodeListOf<HTMLDivElement> = document.querySelectorAll( |
| 35 | '.timeline-segments-progress', |
| 36 | ); |
| 37 | |
| 38 | segments.forEach((each: Segment, index: number) => { |
| 39 | if (each?.end > player?.currentTime()) { |
| 40 | progressEles[index].style.right = |
| 41 | `${((each?.end - player?.currentTime()) / (each?.end - each?.start)) * 100}%`; |
| 42 | } else { |
| 43 | progressEles[index].style.right = '0px'; |
| 44 | } |
| 45 | }); |
| 46 | } |
| 47 | |
| 48 | function previewViaMouseOverOrMove(e: any) { |
| 49 | const timelineContainer = document?.querySelector('#timeline-container'); |