Record¶
This package contains the plugins and extensions to record audio and/or video of either a single trial or multiple trials.
Parameters available in all plugins¶
locale [String | "en-us"]
Optional parameter to set a two-letter language code for translation. In some cases, a regional code will have to be provided as well. For example, we currently support English only from the US region. Therefore, to get the US English translation you would put "en-US" for the locale. We support the following language codes:
| Language | Region | Code |
|---|---|---|
| Basque | eu | |
| Dutch, Flemish | nl | |
| English | U.S.A. | en-US |
| French | fr | |
| Hungarian | hu | |
| Italian | it | |
| Japanese | ja | |
| Portuguese | Brazil | pt-BR |
| Portuguese | pt |
Video Configuration Plugin¶
To record any video during an experiment, including a consent video, you must add a video configuration trial. This trial allows the user to give permissions and select the correct camera and microphone. This trial also does some basic checks on the webcam and mic inputs, so that the participant can fix common problems before the experiment starts.
Create a video configuration trial and put it in your experiment timeline prior
to any other trials that use the participant's webcam/microphone. The trial type
is chsRecord.VideoConfigPlugin.
const videoConfig = { type: chsRecord.VideoConfigPlugin };
Parameters¶
Optional¶
troubleshooting_intro [HTML String]
Optional text to add at the start of the "Setup tips and troubleshooting"
section. This string allows HTML formatting (e.g. <strong></strong> for bold,
<em></em> for italics).
Examples¶
const videoConfig = {
type: chsRecord.VideoConfigPlugin,
troubleshooting_intro:
"If you're having any trouble getting your webcam set up, please feel free to call the XYZ lab at (123) 456-7890 and we'd be glad to help you out!",
};
Video Consent Plugin¶
Users will need to record themselves accepting the consent document for your study. This trial will allow the user to read the consent document and record a video accepting it.
Don't forget a video config trial!
You MUST have a video config trial in your experiment timeline before the video consent trial.
To create the video consent trial:
const videoConsent = { type: chsRecord.VideoConsentPlugin, ...parameters };
Parameters¶
Parameter names are shown below, along with their type and default value. If the default value is undefined, then a value is required for that parameter.
Required¶
PIName [String | undefined]
Name of PI running this study.
institution [String | undefined]
Name of institution running this study (if ambiguous, list institution whose IRB approved the study).
PIContact [String | undefined]
Contact information for PI or lab in case of participant questions or concerns. This will directly follow the phrase “please contact”, so format accordingly: e.g., “the XYZ lab at xyz@science.edu” or “Mary Smith at 123 456 7890”.
payment [String | undefined]
Statement about payment/compensation for participation, including a statement that there are no additional benefits anticipated to the participant. E.g., “After you finish the study, we will email you a $5 BabyStore gift card within approximately three days. To be eligible for the gift card your child must be in the age range for this study, you need to submit a valid consent statement, and we need to see that there is a child with you. But we will send a gift card even if you do not finish the whole study or we are not able to use your child’s data! There are no other direct benefits to you or your child from participating, but we hope you will enjoy the experience.”
This section is by default titled “Are there any benefits to your family?”; it should only include information about benefits and compensation. If your IRB prefers to combine risk/benefit information, you can change this to something like “What are the risks and benefits if you participate?” and include both here, then omit the risk_statement.
procedures [String | undefined]
Brief description of study procedures. For consent templates 001 and 002, this should include any risks or a statement that there are no anticipated risks. (For consent template 003, that is included in payment). We add a statement about the duration (from your study definition) to the start (e.g., “This study takes about 10 minutes to complete”), so you don’t need to include that. It can be in third person or addressed to the parent. E.g., “Your child will be shown pictures of lots of different cats, along with noises that cats make like meowing and purring. We are interested in which pictures and sounds make your child smile. We will ask you (the parent) to turn around to avoid influencing your child’s responses. There are no anticipated risks associated with participating.”
purpose [String | undefined]
Brief description of purpose of study - 1-2 sentences that describe what you are trying to find out. Language should be as straightforward and accessible as possible! E.g., “Why do babies love cats? This study will help us find out whether babies love cats because of their soft fur or their twitchy tails.”
Optional¶
template [String option | "consent-template-5"]
Which consent document template to use. Options: consent-template-5,
consent-garden, consent-recording-only.
Most studies should use consent-template-5 (the default).
If you are running a study that ONLY uses webcam recording for the consent
statement (nothing else is recording during the session), then you should use
the consent-recording-only template. This version removes/modifies some text
that references additional webcam recordings during the session.
By default, the consent-recording-only plugin assumes that, in addition to a
consent trial, you are using CHS to collect other data/responses. If you are not
collecting any other data on CHS (for instance, because the rest of the study
takes place on a different platform), then you should change this using the
only_consent_on_chs parameter (see below).
additional_video_privacy_statement [String | ""]
Optional additional text for under header “Who can see our webcam recordings”. For cases where researchers ask for other specific permission to share videos, separate from the exit survey, or want to provide more detail or different language about Databrary sharing.
datause [String | ""]
Optional study-specific data use statement. This will follow more general text like: “The research group led by [PIName] at [institution] will have access to video and other data collected during this session. We will also have access to your account profile, demographic survey, and the child profile for the child who is participating, including changes you make in the future to any of this information. We may study your child’s responses in connection with his or her previous responses to this or other studies run by our group, siblings’ responses to this or other studies run by our group, or demographic survey responses.” (For exact text, please see specific template.)
You may want to note what measures you will actually be coding for (looking time, facial expressions, parent-child interaction, etc.) and other more specific information about your use of data from this study here. For instance, you would note if you were building a corpus of naturalistic data that may be used to answer a variety of questions (rather than just collecting data for a single planned study).
gdpr [Boolean | false]
Whether to include a section on GDPR.
gdpr_personal_data [String | ""]
List of types of personal information collected, for GDPR section only. Do not include special category information, which is listed separately.
gdpr_sensitive_data [String | ""]
List of types of special category information collected, for GDPR section only. Include all that apply: racial or ethnic origin; political opinions; religious or philosophical beliefs; trade union membership; processing of genetic data; biometric data; health data; and/or sex life or sexual orientation information.
include_databrary [Boolean | false]
Whether to include a paragraph about Databrary under “Who can see our webcam recordings?”.
private_level_only [Boolean | false]
Whether to describe only the “private” video privacy level under the heading “Who will be able to see your webcam recordings?” Only use this option if your IRB has a hard restriction against even offering participants the option to share their videos more broadly, and in conjunction with the corresponding restriction of options in the exit survey!
research_rights_statement [String | ""]
Statement about rights of research subjects and how to contact IRB. For instance, MIT’s standard language is: You are not waiving any legal claims, rights or remedies because of your participation in this research study. If you feel you have been treated unfairly, or you have questions regarding your rights as a research subject, you may contact [CONTACT INFO].
risk_statement [String | ""]
Optional statement; if provided, it is displayed under a header “Are there any risks if you participate?”.
voluntary_participation [String | ""]
Optional additional text for under header “Participation is voluntary”. E.g., “There are two sessions in this study; you will be invited to complete another session next month. It is okay not to do both sessions!”
only_consent_on_chs [Boolean | false]
This parameter is only relevant to the consent-recording-only template. If a
different template is used, this parameter will be ignored.
Whether or not the consent trial is the ONLY data being collected about the
participant on CHS (e.g. the study redirects to an external URL after the
consent trial). If false (the default), then the consent template will contain
information about how CHS handles data/responses. If true, then the template
will only reference the consent recording, and any statements about CHS access
to data/responses are omitted.
Additional customization available if REQUIRED by your IRB¶
To accommodate a variety of idiosyncratic IRB requirements, various other fields are technically customizable. Please start by trying to get approval for a standard Lookit consent form, because it helps participants for the forms to have common structure and language. If your IRB says no, you need to use their usual form that’s 14 pages long, please explain that Lookit requires you to use of one of our standard forms to ensure a smooth participant experience; this is in the Terms of Use! If it really won’t be possible to use Lookit without making more changes, please let us know before using the following fields to further customize the consent form:
purpose_header [String | ""]
Custom alternate header for the section on study purpose.
procedures_header [String | ""]
Custom alternate header for the section on study procedures.
participation_header [String | ""]
Custom alternate header for the section on participation being voluntary.
benefits_header [String | ""]
Custom alternate header for the section on benefits/compensation.
risk_header [String | ""]
Custom alternate header for risks section.
summary_statement [String | ""]
Statement inserted at the beginning of the consent form, right after “Researchers led by … are running this study … on Lookit.” Please only use this if your IRB requires particular information to be included at the beginning of the form; information is usually easier for participants to find under the appropriate header rather than inserted here!
additional_segments [Array]
List of additional custom sections of the consent form, e.g. US Patriot Act Disclosure or child abuse reporting obligation disclosure. These are subject to Lookit approval and in general can only add information that was true anyway but that your IRB needs explicitly listed.
Each section can have fields:
{
title: "title of section",
text: "content of section"
}
prompt_all_adults [Boolean | false]
Whether to include an addition step #4 prompting any other adults present to read a statement of consent (I have read and understand the consent document. I also agree to participate in this study.)
prompt_only_adults [Boolean | false]
Whether to prompt only the adult for consent for themselves to participate, rather than also referencing a child. This is for occasional studies running an adult comparison group.
consent_statement_text [String | ""]
Replace the default spoken consent statement with your custom text.
omit_injury_phrase [Boolean | false]
Whether to omit the phrase “or in the very unlikely event of a research-related injury” from the contact section. (This was required by the Northwestern IRB.)
Examples¶
Standard use case
const videoConsent = {
type: chsRecord.VideoConsentPlugin,
PIName: "Jane Smith",
institution: "Science University",
PIContact: "Jane Smith at 123 456 7890",
purpose:
"Why do babies love cats? This study will help us find out whether babies love cats because of their soft fur or their twitchy tails.",
procedures:
"Your child will be shown pictures of lots of different cats, along with noises that cats make like meowing and purring. We are interested in which pictures and sounds make your child smile. We will ask you (the parent) to turn around to avoid influencing your child's responses.",
risk_statement:
"There are no expected risks if you participate in the study. (This is optional, but should typically be included. If you leave it out there's no 'risks' section and you should include risk information elsewhere.)",
voluntary_participation:
"There are two sessions in this study; you will be invited to complete another session next month. It is okay not to do both sessions! (This is optional; leave it out if you don't need to say anything besides participation in this session being voluntary.)",
payment:
"After you finish the study, we will email you a $5 BabyStore gift card within approximately three days. To be eligible for the gift card your child must be in the age range for this study, you need to submit a valid consent statement, and we need to see that there is a child with you. But we will send a gift card even if you do not finish the whole study or we are not able to use your child's data! There are no other direct benefits to you or your child from participating, but we hope you will enjoy the experience.",
datause:
"We are primarily interested in your child's emotional reactions to the images and sounds. A research assistant will watch your video to measure the precise amount of delight in your child's face as he or she sees each cat picture.",
include_databrary: true,
additional_video_privacy_statement:
"We will also ask your permission to use your videos as stimuli for other parents. (This is optional; leave it out if there aren't additional ways you'll share video beyond as described in the participant's video privacy level and Databrary selections.)",
gdpr: false,
research_rights_statement:
"You are not waiving any legal claims, rights or remedies because of your participation in this research study. If you feel you have been treated unfairly, or you have questions regarding your rights as a research subject, you may contact the [IRB NAME], [INSTITUTION], [ADDRESS/CONTACT]",
additional_segments: [
{
title: "US Patriot Act Disclosure",
text: "[EXAMPLE ONLY, PLEASE REMOVE ADDITIONAL_SEGMENTS UNLESS YOU NEED THEM.] Lookit is a U.S. organization and all information gathered from the website is stored on servers based in the U.S. Therefore, your video recordings are subject to U.S. laws, such as the US Patriot Act. This act allows authorities access to the records of internet service providers. If you choose to participate in this study, you understand that your video recording will be stored and accessed in the USA. The security and privacy policy for Lookit can be found at the following link: <a href='https://lookit.mit.edu/privacy/' target='_blank' rel='noopener'>https://lookit.mit.edu/privacy/</a>.",
},
],
};
Study only uses webcam recording for consent
Use the "consent-recording-only" template when the study collects (some or
all) data/responses on CHS, but webcam recording is only used for the consent
statement (nothing else is recorded).
const videoConsentRecOnly = {
type: chsRecord.VideoConsentPlugin,
template: "consent-recording-only",
PIName: "Jane Smith",
institution: "Science University",
PIContact: "Jane Smith at 123 456 7890",
purpose:
"Why do babies love cats? This study will help us find out whether babies love cats because of their soft fur or their twitchy tails.",
procedures:
"Your child will be shown pictures of lots of different cats, along with noises that cats make like meowing and purring. We are interested in which pictures and sounds make your child smile. We will ask you (the parent) to turn around to avoid influencing your child's responses.",
payment:
"After you finish the study, we will email you a $5 BabyStore gift card within approximately three days. To be eligible for the gift card your child must be in the age range for this study, you need to submit a valid consent statement, and we need to see that there is a child with you. But we will send a gift card even if you do not finish the whole study or we are not able to use your child's data! There are no other direct benefits to you or your child from participating, but we hope you will enjoy the experience.",
};
CHS study is only used for a consent recording
Use the "consent-recording-only" template with only_consent_on_chs: true
when webcam recording is only used for the consent statement and no other
data/responses are collected on CHS.
const videoConsentRecOnly = {
type: chsRecord.VideoConsentPlugin,
template: "consent-recording-only",
only_consent_on_chs: true, // set this to true
PIName: "Jane Smith",
institution: "Science University",
PIContact: "Jane Smith at 123 456 7890",
purpose:
"Why do babies love cats? This study will help us find out whether babies love cats because of their soft fur or their twitchy tails.",
procedures:
"Your child will be shown pictures of lots of different cats, along with noises that cats make like meowing and purring. We are interested in which pictures and sounds make your child smile. We will ask you (the parent) to turn around to avoid influencing your child's responses.",
payment:
"After you finish the study, we will email you a $5 BabyStore gift card within approximately three days. To be eligible for the gift card your child must be in the age range for this study, you need to submit a valid consent statement, and we need to see that there is a child with you. But we will send a gift card even if you do not finish the whole study or we are not able to use your child's data! There are no other direct benefits to you or your child from participating, but we hope you will enjoy the experience.",
};
Video Assent Plugin¶
Use this plugin when you want to get assent from the child participant before the study begins. The plugin displays researcher-provided content across one or more pages that the child can navigate through, then asks the child whether they want to participate. The child's response (yes/no) is saved to the trial data.
Optionally, you can record the child's verbal assent response using the webcam.
Don't forget a video config trial!
If you are showing the webcam on any of the pages (show_webcam) and/or using the recording options (record_whole_procedure or
record_last_page), you MUST have a video config trial in your experiment
timeline before the video assent trial.
To create a video assent trial:
const videoAssent = { type: chsRecord.VideoAssentPlugin, ...parameters };
Parameters¶
Parameter names are shown below, along with their type and default value. If the default value is undefined, then a value is required for that parameter.
Required¶
pages [Array | undefined]
Array of page objects. At least one page must be provided. Each page can have the following fields:
stimulus[HTML String |""]: HTML content to display on the page.show_webcam[Boolean |false]: Whether to show the webcam feed on this page. Ignored if neitherrecord_whole_procedurenorrecord_last_pageistrue.
You can use the stimulus string to embed any kind of HTML-formatted content,
including images, audio, and video (see examples below). Keep in mind that the
stimulus content will be displayed in an area that's about 2/3 the height and
width of the page, which works out to about 715-915px wide x 500-575px high on
large monitors. If you include the webcam feed (show_webcam: true), it will be
displayed in the same area, above any stimulus content. Overflowing content
will cause a vertical scroll bar. Be sure to test your content on a range of
monitor/browser sizes
Optional¶
min_age_to_assent [Integer | 0]
Minimum age in years for the child to be prompted for assent. If the child's age
is known (from their CHS profile) and they are younger than this value, the
trial is skipped and skipped: true is recorded in the data. A value of 0
(the default) means all children will be prompted.
participation_question [String | "Do you want to participate in this study?"]
Question displayed above the yes/no buttons. Can be customized for your study.
yes_button [String | translated "Yes"]
Label for the button the child clicks to indicate they want to participate. By
default, the label is automatically translated based on the locale parameter.
Set this to override the translated default.
no_button [String | translated "No"]
Label for the button the child clicks to indicate they do not want to
participate. By default, the label is automatically translated based on the
locale parameter. Set this to override the translated default.
next_button [String | translated "Next"]
Label for the button used to advance to the next page. Only shown when there is
more than one page. By default, the label is automatically translated based on
the locale parameter. Set this to override the translated default.
previous_button [String | translated "Previous"]
Label for the button used to go back to the previous page. Only shown when there
is more than one page. By default, the label is automatically translated based
on the locale parameter. Set this to override the translated default.
continue_button [String | translated "Continue"]
Label for the button the child clicks to confirm their response and end the
trial. By default, the label is automatically translated based on the locale
parameter. Set this to override the translated default.
record_whole_procedure [Boolean | false]
Whether to start recording at the beginning of the trial and record through the
child's response. If both record_whole_procedure and record_last_page are
true, record_whole_procedure takes precedence.
record_last_page [Boolean | false]
Whether to start recording when the child reaches the final content page and record through their response. Use this when you only want to capture the child's verbal assent, not the earlier informational pages.
parent_intro_text [String | (see below)]
Default:
"<h1>Child assent to participate</h1><p>For studies with older children, we need to check that both the parent <em>and</em> the child agree to participate. <strong>This page is for the child!</strong><br>Parents, please help your child read and navigate if needed.</p>"
This is the HTML-formatted text that should appear at the top of the video
assent page. This is typically used to let parents know what this trial is for.
If left unset, the plugin uses the default parent intro text (or appropriate
translation based on locale). You can also use an empty string ("") for no
parent intro content.
no_response_message [String | (see below)]
Default:
"You have chosen not to participate. Pressing 'submit' will take you to the main Lookit page."
This is the message that should be shown under the yes/no buttons if the
participant clicks the 'no' button. This is intended for a brief message to let
the participant know that they are choosing not to participate, and it gives
them a chance to change their response before continuing. If left unset, the
plugin uses the default confirmation message for a 'no' response (or appropriate
translation based on locale). You can also use an empty string ("") for no
message.
Data¶
response [Boolean]
true if the child clicked "Yes" (wants to participate), false if they
clicked "No".
child_age_years [Integer]
The child's age in years at the time of the trial, derived from their CHS
profile birthday. null if the birthday is not set.
skipped [Boolean]
true if the trial was skipped because the child is younger than
min_age_to_assent. Otherwise not present in the data.
Examples¶
Single content page with defaults
const videoAssent = {
type: chsRecord.VideoAssentPlugin,
pages: [
{
stimulus:
"<p>We are going to show you some pictures of cats. Is that okay?</p>",
},
],
};
Multiple pages with recording on the last page
const videoAssent = {
type: chsRecord.VideoAssentPlugin,
pages: [
{
stimulus: "<p>In this study, you will see pictures of cats and dogs.</p>",
},
{
stimulus: "<p>We will record you answering some questions.</p>",
},
{
stimulus:
"<p>Please say your answer out loud.<br>Parent: please click the button that corresponds to your child's answer.</p>",
show_webcam: true,
},
],
record_last_page: true,
participation_question: "Do you want to be in our study?",
};
Adding images, audio, and video
const videoAssent = {
pages: [
{
stimulus: `<p>You will see some pictures of cats!</p><img src="https://www.mit.edu/~kimscott/placeholderstimuli/img/two_cats.png" style="height:300px;">`,
},
{
stimulus: `<p>You will hear some people talking. Please play the sound below and adjust your volume if you need to.</p><audio src="https://www.mit.edu/~kimscott/placeholderstimuli/mp3/ready.mp3" controls>`,
},
{
stimulus: `<p>You will see videos like this one.</p><video src="https://www.mit.edu/~kimscott/placeholderstimuli/webm/attentiongrabber.webm" autoplay controls>`,
},
],
};
Custom button labels
const videoAssent = {
type: chsRecord.VideoAssentPlugin,
pages: [
{
stimulus: "<p>In this study, you will see pictures of cats and dogs.</p>",
},
],
yes_button: "Yep",
no_button: "Nope",
next_button: ">>",
previous_button: "<<",
continue_button: "Done",
};
Skipping assent for children younger than 7 and recording the whole trial
const videoAssent = {
type: chsRecord.VideoAssentPlugin,
min_age_to_assent: 7,
pages: [
{
stimulus: "<p>Hi! We are going to play a game.</p>",
},
],
record_whole_procedure: true,
participation_question: "Do you want to play?",
};
Trial Recording Extension¶
Trial recording can be added to most jsPsych trials. This is a jsPsych extension that allows you to add video recording to the trial. The trial will start once the video recording has been set up, and the video recording will finish as soon as the trial has ended.
When to use trial recording
Trial recording should NOT occur simultaneously with session recording, or with any plugins that already use the webcam (e.g. video config, video consent).
To use the CHS trial recording extension, you need to:
- Add it to the experiment settings, which is an optional object passed to
initjsPsych. - Add it to the
extensionsparameter for any trial(s) that you want to be recorded.
Don't forget a video config trial!
You MUST have a video config trial in your experiment timeline before doing any trial recording.
Parameters¶
wait_for_upload_message [null or HTML string | null ]
This parameter determines what content should be displayed while the trial
recording is uploading. If null (the default), then the message 'uploading
video, please wait...' (or appropriate translation based on locale) will be
displayed. Otherwise this parameter can be set to a custom string and can
contain HTML markup. If you want to embed images/video/audio in this HTML
string, be sure to preload the media files with the preload plugin and
manual preloading.
Use a blank string ("") for no message/content. If a value is provided then
the locale parameter will be ignored.
max_upload_seconds [ Integer | 10 ]
Maximum duration (in seconds) to wait for the trial recording to finish uploading before continuing with the experiment. If the maximum upload duration is reached and the upload has not finished, then the experiment will move on and the trial recording upload will continue in the background.
Examples¶
Basic usage
To record a single trial, you will have to first load the extension in
initJsPsych.
const jsPsych = initJsPsych({
extensions: [{ type: chsRecord.TrialRecordExtension }],
});
Next, create a video configuration trial as described above. Then, add the trial recoding extension parameter to your trial. By adding this extension, you can record any trial you design.
const trialRec = {
// ... Other trial parameters ...
extensions: [{ type: chsRecord.TrialRecordExtension }],
};
Finally, insert the trials into the timeline.
jsPsych.run([videoConfig, trialRec]);
Setting parameters
You can set the trial extension parameters when you load the extension with
initJsPsych.
In the example below, the default "uploading video, please wait..." message will be displayed in French while a trial recording is uploading at the end of the trial.
const jsPsych = initJsPsych({
extensions: [
{
type: chsRecord.TrialRecordExtension,
params: { locale: "fr" },
},
],
});
And in this example, the custom message "Please wait!" will be displayed while the trial recording is uploading. You can include any HTML-formatted content in this string, which means you can display images, videos, animations etc.
const jsPsych = initJsPsych({
extensions: [
{
type: chsRecord.TrialRecordExtension,
params: { wait_for_upload_message: "<div>Please wait!</div>" },
},
],
});
You can also set the parameters within individual trials. This will override any
parameters set during the extension initialization (in initJsPsych), which can
be useful if you want to change the parameter values during the experiment. In
this example, the wait_for_upload_message is set to an empty string, which
will prevent the default "uploading video, please wait..." message from
appearing after the trial finishes.
const trialRec = {
// ... Other trial parameters ...
extensions: [
{
type: chsRecord.TrialRecordExtension,
params: { wait_for_upload_message: "" },
},
],
};
By default, the trial recording extension will wait up to 10 seconds for the
recording to finish uploading before moving on to the next trial. If the upload
does not finish in that time, it will continue to upload in the background. You
can adjust this duration with the max_upload_seconds parameter. You may want
to increase or decrease this duration depending on the duration of your recorded
trials, or you expect that some participants may have slow/unreliable internet
connections. This example decreases the maximum upload duration from 10 to 5
seconds:
const trialRec = {
// ... Other trial parameters ...
extensions: [
{
type: chsRecord.TrialRecordExtension,
params: { max_upload_seconds: 5 },
},
],
};
Session Recording¶
You might prefer to record across multiple trials in a study session. This can be done by using trials created with the start and stop recording plugins. This gives a bit of flexibility over which of the study trials are recorded.
When to use session recording
Sesssion recording should NOT occur simultaneously with trial recording, or with any plugins that already use the webcam (e.g. video config, video consent).
To record a set of trials, add a 'start' trial in your jsPsych experiment timeline right before you'd like to start recording, and add a 'stop' trial at the point in your timeline when you'd like to stop recording.
Don't forget a video config trial!
You MUST have a video config trial in your experiment timeline before doing any session recording.
Start Recording Plugin¶
The plugin to start session recording is called chsRecord.StartRecordPlugin.
const startRec = { type: chsRecord.StartRecordPlugin };
Parameters¶
wait_for_connection_message [null or HTML string | null ]
This parameter determines what content should be displayed while the session
recording is initializing. If null (the default), then the message
'establishing video connection, please wait' (or appropriate translation based
on locale) will be displayed. Otherwise this parameter can be set to a custom
string and can contain HTML markup. If you want to embed images/video/audio in
this HTML string, be sure to preload the media files with the preload plugin
and
manual preloading.
Use a blank string ("") for no message/content. If a value is provided then
the locale parameter will be ignored.
Stop Recording Plugin¶
The plugin to stop session recording is called chsRecord.StopRecordPlugin.
const stopRec = { type: chsRecord.StopRecordPlugin };
When the trial starts, by default, this plugin will display "uploading video,
please wait...", or the appropriate translation based on the locale parameter.
This message can be customized using the wait_for_upload_message parameter,
which is the HTML-formatted string to be displayed while the session recording
is uploading.
const stopRec = {
type: chsRecord.StopRecordPlugin,
wait_for_upload_message:
"<p style='color:red;'>Please wait while we upload your video.</p>",
};
Parameters¶
wait_for_upload_message [null or HTML string | null ]
This parameter determines what content should be displayed while the session
recording is uploading. If null (the default), then the message 'uploading
video, please wait...' (or appropriate translation based on locale) will be
displayed. Otherwise this parameter can be set to a custom string and can
contain HTML markup. If you want to embed images/video/audio in this HTML
string, be sure to preload the media files with the preload plugin and
manual preloading.
Use a blank string ("") for no message/content. If a value is provided then
the locale parameter will be ignored.
max_upload_seconds [ Integer | 10 ]
Maximum duration (in seconds) to wait for the session recording to finish uploading before continuing with the experiment. If the maximum upload duration is reached and the upload has not finished, then the experiment will move on and the session recording upload will continue in the background.
Examples¶
Basic usage
First, make sure that you've added a video config trial to your experiment timeline. Then, create your start and stop recording trials:
const startRec = { type: chsRecord.StartRecordPlugin };
const stopRec = { type: chsRecord.StopRecordPlugin };
Next, create the trials that you would like to be recorded.
const morning = { type: jsPsychHtmlKeyboardResponse, stimulus: "Good morning!" };
const evening = { type: jsPsychHtmlKeyboardResponse stimulus: "Good evening!" };
const night = { type: jsPsychHtmlKeyboardResponse, stimulus: "Good night!" };
Lastly, add these trials to the timeline. Again, the video configuration trial must come before any other recording trials.
jsPsych.run([videoConfig, startRec, morning, evening, night, stopRec]);
It's possible to record only some of the trials. This can be done by moving the stop or start recording trials within the timeline.
jsPsych.run([videoConfig, startRec, morning, evening, stopRec, night]);
You can also create more than one session recording:
jsPsych.run([
videoConfig,
startRec,
morning,
stopRec,
evening,
startRec,
night,
stopRec,
]);
Setting parameters
By default, the start session recording plugin will display "establishing video
connection, please wait" while establishing the connection to our video storage,
and the stop session recording plugin will display "uploading video, please
wait..." while the session recording is uploading. You can set the locale
parameter value to translate these messages to another language. For example,
the trial below will display the Brazilian Portuguese translation of these
messages. If the locale string does not match any of the translation codes that
we support, then the message will be displayed in English.
const startpRec = {
type: type: chsRecord.StartRecordPlugin,
locale: "pt-br",
};
const stopRec = {
type: chsRecord.StopRecordPlugin,
locale: "pt-br",
};
You can also set custom content to be displayed at the start of the session recording, while it is initializing, and/or at the end, when the file is uploading. The value must be a string. It can include HTML-formatted content, which means that you can embed audio, video, images etc. (be sure to preload any media files!).
const startpRec = {
type: type: chsRecord.StartRecordPlugin,
wait_for_connection_message: "<p style='color:green;>Please wait...</p>"
};
const stopRec = {
type: chsRecord.StopRecordPlugin,
wait_for_upload_message: "<p style='color:red;'>Hang on a sec!</p>",
};
By default, the stop session recording plugin will wait up to 10 seconds for the
session recording to finish uploading before moving on with the experiment. If
the upload does not finish in that time, it will continue to upload in the
background. You can adjust this duration with the max_upload_seconds
parameter. You may want to increase this duration if, for example, your
experiment creates a very long session recording, or you expect that some
participants may have slow/unreliable internet connections. This example
increases the maximum upload duration from 10 to 20 seconds:
const stopRec = {
type: chsRecord.StopRecordPlugin,
max_upload_seconds: 20,
};