From 2e1757192cb73b917b552bfced4639d90bd37d8b Mon Sep 17 00:00:00 2001 From: Josh de Leeuw Date: Tue, 12 Jul 2022 13:20:16 -0400 Subject: [PATCH] add extension docs --- .../jspsych-extension-record-video-demo1.html | 62 +++++++++++++ docs/extensions/record-video.md | 90 +++++++++++++++++++ 2 files changed, 152 insertions(+) create mode 100644 docs/demos/jspsych-extension-record-video-demo1.html create mode 100644 docs/extensions/record-video.md diff --git a/docs/demos/jspsych-extension-record-video-demo1.html b/docs/demos/jspsych-extension-record-video-demo1.html new file mode 100644 index 00000000..0d7953d1 --- /dev/null +++ b/docs/demos/jspsych-extension-record-video-demo1.html @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + diff --git a/docs/extensions/record-video.md b/docs/extensions/record-video.md new file mode 100644 index 00000000..e2d52008 --- /dev/null +++ b/docs/extensions/record-video.md @@ -0,0 +1,90 @@ +# record-video + +This extension records video from the participant's webcam during a trial. + +This extension encodes the video data in [base 64 format](https://developer.mozilla.org/en-US/docs/Glossary/Base64). +This is a text-based representation of the video which can be coverted to various video formats using a variety of [online tools](https://www.google.com/search?q=base64+video+decoder) as well as in languages like python and R. + +## Parameters + +### Initialization Parameters + +Initialization parameters can be set when calling `initJsPsych()` + +```js +initJsPsych({ + extensions: [ + {type: jsPsychExtensionRecordVideo, params: {...}} + ] +}) +``` + +Parameter | Type | Default Value | Description +----------|------|---------------|------------ + + +### Trial Parameters + +Trial parameters can be set when adding the extension to a trial object. + +```js +var trial = { + type: jsPsych..., + extensions: [ + {type: jsPsychExtensionRecordVideo, params: {...}} + ] +} +``` + +Parameter | Type | Default Value | Description +----------|------|---------------|------------ + + +## Data Generated + +Name | Type | Value +-----|------|------ +record_video_data | base64 string | [Base 64 encoded](https://developer.mozilla.org/en-US/docs/Glossary/Base64) representation of the video data. + +## Examples + +???+ example "Record video data during a trial" + === "Code" + ```javascript + const init_camera = { + type: jsPsychInitializeCamera + }; + + const trial = { + type: jsPsychHtmlButtonResponse, + stimulus: `
+
+
+ `, + choices: ['Done'], + prompt: "

Video is recording. Click done after a few seconds.

", + extensions: [ + {type: jsPsychExtensionRecordVideo} + ] + }; + ``` + + === "Demo" +
+ +
+ + Open demo in new tab \ No newline at end of file