Facing an error while detecting faces from video frame in JS

I am trying to detect faces and emotions from a video that is loaded in a canvas element.
I am using drawvideo() function to load a local .mp4 to the canvas element.
Once loaded, and after some debugging, I see that this condition is never true “if(faces.length > 0 )” Which means the data being received does not have the faces data? or maybe I am missing something very obvious here?
Following this tut here. https://affectiva.readme.io/docs/analyze-a-video-frame-stream-4
and my code can be found here> https://github.com/wahab-bese14seecs/FYP-CANVAS

Can someone please test and let me know what is going on.

The condition

(faces.length > 0)

passes when the SDK detects a face. Are you passing an empty frame and encountering this?