adv.idleDetect()

wrtc.adv.idleDetect() starts or stops user activity monitoring. If user is inactive, does not touch mouse or keyboard for several minutes, or if unit's screen is turned off or starts showing screensaver a wrtc.onIdle() event will occur. If user becomes active and touches mouse or keyboard, or if unit's screen returns to normal on state another wrtc.onIdle() event will occur.

Arguments

wrtc.adv.idleDetect(detect, minutes)

  • detect - boolean: true = start monitoring, false = stop monitoring
  • minutes - (optional) number of minutes of mouse/keyboard inactivity before user is assumed to be inactive. If not provided the default value of 10 minutes will be used.

Returns

true if idle detection could be started or false if any problem has occurred that made idle detection impossible.

Idle detection can be denied by both system, browser and user.

Usage

Most operating systems ask user for approval before activating monitoring. Web browsers such as chrome only accept call to wrtc.adv.idleDetect(true) in code from buttons or other web elements activated by user response. Usually you cannot call wrtc.adv.idleDetect(true) from wrtc.init() or any other passive code - you must call it from code that is activated upon user input. See example below:

Example

To enable user activity monitoring on your webpage:

Permission request: User passivity detection <button type="button" onclick="wrtc.adv.idleDetect(true);">Allow</button>

A more "stealth" way of activation might be:

function startDetect() {
  wrtc.adv.idleDetect(true);
  window.removeEventListener('mousedown', startDetect);
}
window.addEventListener('mousedown', startDetect);

This will activate idle detection as soon as user clicks anywhere on web page.

See Also

ixnx/wrtc/js/api/wrtc/adv.idledetect.txt · Last modified: by tibor
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0