File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
dotcom-rendering/src/components Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -44,14 +44,14 @@ export const LoopVideoProgressBar = ({
44
44
if ( duration <= 0 ) return null ;
45
45
46
46
/**
47
- * We achieve a smooth progress bar by using CSS transitions. However, this means that
48
- * the time on the progress bar is roughly always about 0.25 seconds behind - the interval in
49
- * which the onTimeUpdate event on video is fired. Therefore, to the user it looks like the
50
- * progress bar ranges from 0s to duration - 0.25s. To make allowance for this, when calculating
51
- * the progress percentage, we take 0.25s off the duration, so that the progress bar reaches
52
- * closer to the end .
47
+ * We achieve a smooth progress bar by using CSS transitions. Given that
48
+ * onTimeUpdate firesevery 250ms or so, this means that the time on the
49
+ * progress bar is always about 0.25s behind and begins 0.25s late.
50
+ * Therefore, when calculating the progress percentage, we take 0.25s off the duration.
51
+ *
52
+ * Videos less than a second in duration will have no adjustment .
53
53
*/
54
- const adjustedDuration = Math . max ( duration - 0.25 , 0.1 ) ;
54
+ const adjustedDuration = duration > 1 ? duration - 0.25 : duration ;
55
55
56
56
const progressPercentage = Math . min (
57
57
( currentTime * 100 ) / adjustedDuration ,
You can’t perform that action at this time.
0 commit comments