I have successfully loaded a video using VideoDrawable on the function OnEnterFieldofVision. However, I would like the drawable to have a function that, if the video started playing, some variable will be set to true and the current time will be saved. Then if the target was out of the view for sometime, a timer will start. After 5 seconds, if the target has not been seen by the camera, the video will not play anymore, or call stop(). Should I use setTimeout? Or there are other implementations? Thanks!
over 4 years ago
Yes, setTimeout is the way to go. Just start it in onExitFieldOfVision and store the return value somewhere. in onEnterFieldOfVision you can call clearTimeout with the stored return value to cancel it.