Show:

Infant-controlled-timing Class

These docs have moved here.

Reference for DEVELOPERS of new frames only! Mixin to allow parent to control frame progression by holding down a key when the child is not looking. Enables "infant-controlled" study designs via parent live-coding of infant looking behavior. To add this behavior to an existing frame:

  1. Call this.startParentControl() at the point you want looking time to start being measured. The parent will only be able to end the trial using the endTrialKey during the parent control period. Lookaway time will only accumulate and lookaways will only be able to end the trial during the parent control period. However, lookaways will be recorded as events throughout the frame. If the child is already looking away before the parent control period begins, lookaway time will begin accumulating only after the first look.
  2. Call this.endParentControl() at the point you want the parent not to be able to control frame progression anymore. For instance, if hiding stimuli and stopping recording after completing the frame, or if pausing the frame.
  3. If you need to be able to pause and re-start the frame, call this.endParentControl() when pausing and this.startParentControl() when re-starting. Note that startParentControl will start a "fresh" looking time measurement: looking and lookaway time will both be 0, the child will not be assumed to have already looked, etc.
  4. Define a function onLookawayCriterion that says what should happen when the parent presses the endTrialKey or the child reaches the lookaway criterion. E.g., this might typically move to the next frame. If needed you can access this.get('trialEndReason') (either 'parentEnded' or 'lookaway') to distinguish between these two possibilities.
  5. If it is possible for the frame to end by other mechanisms than the trialEndKey or reaching the lookaway criterion, then when that happens: set the trialEndReason accordingly (e.g., this.set('trialEndReason', 'ceiling')) and call this.setTrialEndTime() to calculate a total looking time based on the
  6. So that your frame will capture information about looking time and the reason the trial ended, and make that available to the researcher, add the following to your frame's meta.data.properties:
      totalLookingTime: {
          type: 'number'
      },
      trialEndReason: {
          type: 'string'
      }
    

Methods

endParentControl

()

End period of parent control of trial progression, for instance because trial is paused. Looks to/away will still be logged as events but trial will not end based on parent input.

onSessionRecordingStarted

()

Hook called when session recording is started automatically. Override to do frame-specific actions at this point (e.g., beginning a test trial).

startParentControl

()

Begin period of parent control of trial progression. After calling startParentControl(), we wait for the first infant look to the screen (this may be immediate because infant is already looking. After that, whenever infant look-away time reaches criterion (either due to long enough continuous lookaway, or due to cumulative time looking away) we will call onLookawayCriterion().

If startParentControl is called multiple times, each time it's called it starts a "fresh" interval of parent control - i.e. no stored lookaway time, and no assumption the child has previously looked.

Properties

endTrialKey

String

Specific to this element. Defined in app/mixins/infant-controlled-timing.js:105

Key parent should press to manually move on to next trial. This allows you to have parents control the study by giving instructions like "press q when the child looks away for at least a few seconds" instead of "hold down w whenever the child isn't looking." Use an empty string, '', to not allow this function for this trial. You can look up the names of keys at https://keycode.info. Default is 'q'.

Default: 'q'

lookawayKey

String

Specific to this element. Defined in app/mixins/infant-controlled-timing.js:91

Key parent should press to indicate the child is looking away. If a key is provided, then the trial will end if the child looks away looks long enough per the lookawayType and lookawayThreshold. You can also use 'mouse' to indicate that mouse down/up should be used in place of key down/up events. Use an empty string, '', to not record any lookaways for this trial. You can look up the names of keys at https://keycode.info. Default is 'w'.

Default: 'w'

lookawayThreshold

String

Specific to this element. Defined in app/mixins/infant-controlled-timing.js:77

Lookaway threshold in seconds. How long does the child need to look away before the trial ends? Depending on the lookawayType, this will refer either to the total amount of time the child has looked away since their first look to the screen, or to the length of a single continuous lookaway.

Default: 2

lookawayTone

String

Specific to this element. Defined in app/mixins/infant-controlled-timing.js:118

Type of audio to play during parent-coded lookaways - 'tone' (A 220), 'noise' (pink noise), or 'none'. These tones are available at https://www.mit.edu/~kimscott/placeholderstimuli/ if you want to use them in instructions.

Default: 'noise'

lookawayToneVolume

String

Specific to this element. Defined in app/mixins/infant-controlled-timing.js:132

Volume of lookaway tone

Default: 0.25

lookawayType

String

Specific to this element. Defined in app/mixins/infant-controlled-timing.js:62

Type of lookaway criterion. Must be either 'total' (to count total lookaway time) or 'continuous' (to count only continuous lookaway time). Whichever criterion type is used, only lookaways after the first look to the screen are considered.

Default: 'total'

Data keys collected

These are the fields that will be captured by this frame and sent back to the Lookit server. Each of these fields will correspond to one row of the CSV frame data for a given response - the row will have key set to the data key name, and value set to the value for this response. Equivalently, this data will be available in the exp_data field of the response JSON data.

totalLookingTime

Number

Total looking time during this frame, in seconds. Looking time is calculated as the total time spent looking between: (1) The start of the parent control period, or the first look during that period if the child is not looking initially and (2) The end of the trial due to the parent pushing the end trial key, the child reaching the lookaway criterion, or the frame being completed without either of these happening (e.g., a video is played N times or an image is shown for N seconds). All time spent looking away, per parent coding, is excluded, regardless of the duration of the lookaway.

This value will be null if the trial is not completed by any of the above mechanisms, for instance because the parent ends the study early during this frame.

trialEndReason

String

What caused the trial to end: 'lookaway' (the child reached the lookaway threshold), 'parentEnded' (the parent pressed the endTrialKey), or 'ceiling' (the frame ended without either of those happening).

This value will be null if the trial is not completed by any of the above mechanisms, for instance because the parent ends the study early during this frame.

Events

lookawayEnd

When parent records a lookaway ending. This will NOT be triggered at the start of this frame if the parent is not holding down the lookawayKey, only when the key is actually released. Lookaways are recorded regardless of whether the parent control period has started.

lookawayEndedTrial

When trial ends due to lookaway criterion being reached.

lookawayStart

When parent records a lookaway starting. This will be triggered at the start of this frame if the parent is already holding down the lookawayKey, and otherwise only when the key is newly pressed down. Lookaways are recorded regardless of whether the parent control period has started.

parentControlPeriodEnd

When interval of parent control of trial ends - i.e., lookaways cannot lead to ending trial, parent cannot press key to end trial.

parentControlPeriodStart

When interval of parent control of trial begins - i.e., lookaways begin counting up to threshold. Lookaway events are recorded throughout, but do not count towards ending trial until parent control period begins.

parentEndedTrial

When trial ends due to parent pressing key to end trial