(value: number[])
| 1116 | } |
| 1117 | |
| 1118 | const updateABloop = (value: number[]) => { |
| 1119 | const loopStart = value[0] |
| 1120 | const loopEnd = value[1] |
| 1121 | const current = videoRef.current ? videoRef.current.currentTime : progress |
| 1122 | const duration = getDuration() |
| 1123 | |
| 1124 | let start = reverse ? (duration / 100) * (100 - loopStart) |
| 1125 | : (duration / 100) * loopStart |
| 1126 | |
| 1127 | let end = reverse ? (duration / 100) * (100 - loopEnd) |
| 1128 | : (duration / 100) * loopEnd |
| 1129 | |
| 1130 | if (videoData && videoRef.current) { |
| 1131 | start = duration - start |
| 1132 | end = duration - end |
| 1133 | } |
| 1134 | |
| 1135 | if (reverse) { |
| 1136 | if (current > start || current < end) { |
| 1137 | if (videoRef.current) videoRef.current.currentTime = end |
| 1138 | setProgress(end) |
| 1139 | setSeekTo(end) |
| 1140 | } |
| 1141 | } else { |
| 1142 | if (current < start || current > end) { |
| 1143 | if (videoRef.current) videoRef.current.currentTime = start |
| 1144 | setProgress(start) |
| 1145 | setSeekTo(start) |
| 1146 | } |
| 1147 | } |
| 1148 | setDragging(false) |
| 1149 | setABDragging(false) |
| 1150 | } |
| 1151 | |
| 1152 | const toggleAB = (value?: boolean) => { |
| 1153 | const currentABloop = value !== undefined ? value : !abloop |
no test coverage detected