API Docs for: 0.5.1
Show:

ExpLookitPreferentialLooking Class

Frame to implement a basic preferential looking trial, with static images displayed in the center or at left and right of the screen. Trial proceeds in segments:

  • Intro: central attentiongrabber video (looping) & intro audio [wait until recording is established to move on, and a minimum amount of time]
  • Test: image(s) displayed, any test audio played [set amount of time] OR Calibration: calibration video displayed at center, left, right, center, each for calibrationLength s.
  • Final audio: central attentiongrabber video (looping) & final audio (optional section, intended for last trial in block)

There are three basic uses of this frame expected:

  • Familiarization trial with a single central image. Provide a value for centerImage, but not rightImage or leftImage.
  • Test trial with right and left images. Provide a value for rightImage and leftImage, but not centerImage. (There is no explicit "preferential looking vs. familiarization" switch: all of the images provided will be displayed.)
  • Calibration trial. Set isCalibrationFrame to true, and provide calibrationLength (length of each calibration segment in s), calibrationVideoSources, and calibrationAudioSources.

This frame extends ExpFrameBaseUnsafe because it is displayed fullscreen and is expected to be repeated.

"frames": {
   "preferential-looking": {
       "kind": "exp-lookit-preferential-looking",
       "id": "pref-trial",
       "isCalibrationFrame": false,
       "allowPausingDuringTest": true,
       "baseDir": "https://s3.amazonaws.com/lookitcontents/labelsconcepts/",
       "audioTypes": ["mp3", "ogg"],
       "videoTypes": ["webm", "mp4"],
       "rightImage": "fam.jpg",
       "leftImage": "novel.jpg",
       "centerImage": "0001.jpg",
       "pauseAudio": [
           {
               "src": "https://s3.amazonaws.com/lookitcontents/geometry/mp3/pause.mp3",
               "type": "audio/mp3"
           },
           {
               "src": "https://s3.amazonaws.com/lookitcontents/geometry/ogg/pause.ogg",
               "type": "audio/ogg"
           }
       ],
       "trialLength": 10,
       "fsAudio": [
           {
               "src": "https://s3.amazonaws.com/lookitcontents/geometry/mp3/fullscreen.mp3",
               "type": "audio/mp3"
           },
           {
               "src": "https://s3.amazonaws.com/lookitcontents/geometry/ogg/fullscreen.ogg",
               "type": "audio/ogg"
           }
       ],
       "calibrationLength": 3,
       "attnLength": 1,
       "endAudioSources": [
           {
               "src": "https://s3.amazonaws.com/lookitcontents/geometry/mp3/all_done.mp3",
               "type": "audio/mp3"
           },
           {
               "src": "https://s3.amazonaws.com/lookitcontents/geometry/ogg/all_done.ogg",
               "type": "audio/ogg"
           }
       ],
       "introAudioSources": [
           {
               "src": "https://s3.amazonaws.com/lookitcontents/geometry/mp3/chimes.mp3",
               "type": "audio/mp3"
           },
           {
               "src": "https://s3.amazonaws.com/lookitcontents/geometry/ogg/chimes.ogg",
               "type": "audio/ogg"
           }
       ],
       "testAudioSources": [
           {
               "stub": "Familiarization_find_dax_amplified_repeated"
           }
       ],
       "unpauseAudio": [
           {
               "src": "https://s3.amazonaws.com/lookitcontents/geometry/mp3/return_after_pause.mp3",
               "type": "audio/mp3"
           },
           {
               "src": "https://s3.amazonaws.com/lookitcontents/geometry/ogg/return_after_pause.ogg",
               "type": "audio/ogg"
           }
       ],
       "calibrationVideoSources": [
           {
               "src": "https://s3.amazonaws.com/lookitcontents/geometry/webm/attention.webm",
               "type": "video/webm"
           },
           {
               "src": "https://s3.amazonaws.com/lookitcontents/geometry/mp4/attention.mp4",
               "type": "video/mp4"
           }
       ],
       "videoSources": [
           {
               "src": "https://s3.amazonaws.com/lookitcontents/exp-physics-final/stimuli/attention/webm/attentiongrabber.webm",
               "type": "video/webm"
           },
           {
               "src": "https://s3.amazonaws.com/lookitcontents/exp-physics-final/stimuli/attention/mp4/attentiongrabber.mp4",
               "type": "video/mp4"
           }
       ],
       "calibrationAudioSources": [
           {
               "src": "https://s3.amazonaws.com/lookitcontents/geometry/mp3/chimes.mp3",
               "type": "audio/mp3"
           },
           {
               "src": "https://s3.amazonaws.com/lookitcontents/geometry/ogg/chimes.ogg",
               "type": "audio/ogg"
           }
       ]
   }
}

Methods

exitFullscreen

()
Exit fullscreen mode

serializeContent

(
  • videoID
  • hasBeenPaused
  • isCalibrationFrame
  • allowPausingDuringTest
  • rightImage
  • leftImage
  • centerImage
  • trialLength
  • calibrationLength
  • testAudioSources
  • eventTimings
)
Object

Parameters captured and sent to the server

Parameters:

  • videoID String

    The ID of any video recorded during this frame

  • hasBeenPaused Boolean

    whether this trial was paused

  • isCalibrationFrame Boolean

    whether this is a calibration frame (given as a property of the frame)

  • allowPausingDuringTest Boolean

    whether the user can return to the test/calibration period after pausing (given as a property of the frame)

  • rightImage String

    URL of image shown on right (given as a property of the frame)

  • leftImage String

    URL of image shown on left (given as a property of the frame)

  • centerImage String

    URL of image shown at center (given as a property of the frame)

  • trialLength Number

    seconds to display images if this is a test trial (given as a property of the frame)

  • calibrationLength Number

    s to display calibration video in each of four locations if this is a calibration trial (given as a property of the frame)

  • testAudioSources Object[]

    Array of {src: 'url', type: 'MIMEtype'} objects for audio played during test trial (given as a property of the frame)

  • eventTimings Object

Returns:

Object:

The payload sent to the server

showFullscreen

()
Make a specified element fullscreen

Properties

allowPausingDuringTest

Boolean

Whether to allow user to pause the study during the test segment and restart from intro; otherwise, user can pause but this frame will end upon unpausing. Applies to pausing during both image display and calibration segments. Pausing is always allowed during the intro.

attnLength

Number

minimum amount of time to show attention-getter in seconds. attention-getter intro video will be shown for at least this long, and also until any intro audio finishes playing and a webcam connection is established.

Default: 5

audioTypes

String[]

List of audio types to expect for any audio specified just with a string rather than with a list of src/type pairs. If audioTypes is ['typeA', 'typeB'] and an audio source (e.g. introAudioSources) is given as [{'stub': 'intro'}], then introAudioSources will be expanded out to

                [
                       {
                           src: 'baseDir' + 'typeA/intro.typeA',
                           type: 'audio/typeA'
                       },
                       {
                           src: 'baseDir' + 'typeB/intro.typeB',
                           type: 'audio/typeB'
                       }
               ]

Default: ['mp3', 'ogg']

baseDir

String

Base directory for where to find stimuli. Any image src values that are not full paths will be expanded by prefixing with baseDir + img/. Any audio/video src values that give a value for 'stub' rather than 'src' and 'type' will be expanded out to baseDir/avtype/[stub].avtype, where the potential avtypes are given by audioTypes and videoTypes.

Note that baseDir SHOULD include a trailing slash (e.g., http://stimuli.org/myexperiment/, not http://stimuli.org/myexperiment)

Default: ''

calibrationAudioSources

Object[]

Sources Array of {src: 'url', type: 'MIMEtype'} objects for calibration audio, played from start during each calibration segment (only used if isCalibrationFrame)

Can also give a single element {stub: 'filename'}, which will be expanded out to the appropriate array based on baseDir and audioTypes values; see audioTypes.

calibrationLength

Number

length of single calibration segment in seconds (only used if isCalibrationFrame)

Default: 3

calibrationVideoSources

Object[]

Sources Array of {src: 'url', type: 'MIMEtype'} objects for calibration video, played from start during each calibration segment (only used if isCalibrationFrame)

Can also give a single element {stub: 'filename'}, which will be expanded out to the appropriate array based on baseDir and videoTypes values; see videoTypes.

centerImage

String

URL of image to show at center, if any. Can be a full URL or a stub that will be appended to baseDir + img/ (see baseDir).

endAudioSources

Object[]

Sources Array of {src: 'url', type: 'MIMEtype'} objects for audio played after trial ends (optional, intended for use on last trial to let parents know they can open their eyes)

Can also give a single element {stub: 'filename'}, which will be expanded out to the appropriate array based on baseDir and audioTypes values; see audioTypes.

fsAudio

Object[]

Sources Array of {src: 'url', type: 'MIMEtype'} objects for audio played when study is paused due to not being fullscreen

Can also give a single element {stub: 'filename'}, which will be expanded out to the appropriate array based on baseDir and audioTypes values; see audioTypes.

fsButtonID

String
The element ID of a button to show if the user leaves fullscreen mode

fullScreenElementId

String
The element ID of the thing to make full screen (video element, div, etc)

introAudioSources

Object[]

Sources Array of {src: 'url', type: 'MIMEtype'} objects for instructions or any other audio during attention-getter video

Can also give a single element {stub: 'filename'}, which will be expanded out to the appropriate array based on baseDir and audioTypes values; see audioTypes.

isCalibrationFrame

Boolean

Whether to do calibration instead of a static image display. If this is true, then provide calibrationLength, calibrationAudioSources, and calibrationVideoSources as well.

Default: false

leftImage

String

URL of image to show on left, if any. Can be a full URL or a stub that will be appended to baseDir + img/ (see baseDir).

pauseAudio

Object[]

Sources Array of {src: 'url', type: 'MIMEtype'} objects for audio played upon pausing study

Can also give a single element {stub: 'filename'}, which will be expanded out to the appropriate array based on baseDir and audioTypes values; see audioTypes.

right

String

URL of image to show on right, if any. Can be a full URL or a stub that will be appended to baseDir + img/ (see baseDir).

testAudioSources

Object[]

Sources Array of {src: 'url', type: 'MIMEtype'} objects for audio played during test trial. (Only used if not isCalibrationFrame.)

Can also give a single element {stub: 'filename'}, which will be expanded out to the appropriate array based on baseDir and audioTypes values; see audioTypes.

trialLength

Number

length of preferential looking trial in seconds. (Only used if not isCalibrationFrame.)

Default: 6

unpauseAudio

Object[]

Sources Array of {src: 'url', type: 'MIMEtype'} objects for audio played upon resuming study

Can also give a single element {stub: 'filename'}, which will be expanded out to the appropriate array based on baseDir and audioTypes values; see audioTypes.

videoSources

Object[]

Sources Array of {src: 'url', type: 'MIMEtype'} objects for attention-getter video

Can also give a single element {stub: 'filename'}, which will be expanded out to the appropriate array based on baseDir and videoTypes values; see videoTypes.

videoTypes

String[]

List of video types to expect for any video specified just with a string rather than with a list of src/type pairs. If video is ['typeA', 'typeB'] and an video source is given as {['stub': 'attn']}, then the video source will be expanded out to

                [
                       {
                           src: 'baseDir' + 'typeA/attn.typeA',
                           type: 'video/typeA'
                       },
                       {
                           src: 'baseDir' + 'typeB/attn.typeB',
                           type: 'video/typeB'
                       }
               ]

Default: ['mp3', 'ogg']

Events

enteredFullscreen

Upon detecting change to fullscreen mode

leftFullscreen

Upon detecting change out of fullscreen mode

nextFrame

Move to next frame

onCamAccess

When recorder detects a change in camera access

Event Payload:

pauseVideo

When pausing study, immediately before request to pause webcam recording

startCalibration

Start of EACH calibration segment

Event Payload:

  • location String

    location of calibration ball, relative to child: 'left', 'right', or 'center'

startIntro

Just before starting intro segment

stoppingCapture

Just before stopping webcam video capture

unpauseVideo

When unpausing study, immediately before request to resume webcam recording

videoStreamConnection

When recorder detects a change in video stream connection status

Event Payload:

  • status String

    status of video stream connection, e.g. 'NetConnection.Connect.Success' if successful