Skip to content

Commit a95d39d

Browse files
fixed looping issue in video example
1 parent 6fd645e commit a95d39d

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

examples/views/videoFaceTracking.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@
161161
}
162162

163163
async function onPlay(videoEl) {
164-
if(videoEl.paused || videoEl.ended || !isFaceDetectionModelLoaded())
164+
if(!videoEl.currentTime || videoEl.paused || videoEl.ended || !isFaceDetectionModelLoaded())
165165
return setTimeout(() => onPlay(videoEl))
166166

167167

examples/views/webcamFaceTracking.html

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,13 +180,11 @@
180180

181181
updateTimeStats(Date.now() - ts)
182182

183-
if (result) {
184-
const drawFunction = withFaceLandmarks
185-
? drawLandmarks
186-
: drawDetections
183+
const drawFunction = withFaceLandmarks
184+
? drawLandmarks
185+
: drawDetections
187186

188-
drawFunction(videoEl, $('#overlay').get(0), [result], withBoxes)
189-
}
187+
drawFunction(videoEl, $('#overlay').get(0), result || [], withBoxes)
190188

191189
setTimeout(() => onPlay())
192190
}

0 commit comments

Comments
 (0)