start()
start() runs the detector runtime in a logged-in MonitorDog SDK session.
After login() finishes authentication/session preparation and account/policy preparation, start() handles model loading, camera permission requests, webcam stream setup, and the detection loop.
Role
When start() is called, the SDK internally performs the following work in order.
Check login state
-> Load detection model
-> Request camera permission
-> Start webcam stream
-> Run detection loop
Usage Example
await detector.login({
email: currentUser.email,
});
await detector.start();
If start() is called again while the detector is already running, it is handled as a successful no-op.
Failure Handling
start() can fail in the following situations.
- Called before
login():NOT_LOGGED_IN - Detection model load failed:
MODEL_LOAD_FAILED - Browser camera permission denied:
CAMERA_PERMISSION_DENIED - Camera stream could not be read:
CAMERA_READ_FAILED - Other runtime start failure:
RUNTIME_START_FAILED
Notes
- The camera permission prompt appears when
start()is called, not whenlogin()is called. - When the screen or component disappears, stop local detection first with
stop(). - Token/session state is managed by
login()andlogout(), not bystart().