jspsych 8.2.1 → 8.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.browser.js +95 -3
- package/dist/index.browser.js.map +1 -1
- package/dist/index.browser.min.js +7 -7
- package/dist/index.browser.min.js.map +1 -1
- package/dist/index.cjs +94 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +94 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/modules/plugin-api/MediaAPI.ts +28 -1
- package/src/modules/plugins.ts +1 -0
- package/src/timeline/Trial.spec.ts +105 -1
- package/src/timeline/Trial.ts +78 -0
package/README.md
CHANGED
|
@@ -61,7 +61,7 @@ Citations help us demonstrate that this library is used and valued, which allows
|
|
|
61
61
|
## Contributors
|
|
62
62
|
|
|
63
63
|
jsPsych is open source project with [numerous contributors](https://github.com/jspsych/jsPsych/graphs/contributors).
|
|
64
|
-
The project is currently managed by the core team of Josh de Leeuw ([@jodeleeuw](https://github.com/jodeleeuw)), Becky Gilbert ([@becky-gilbert](https://github.com/becky-gilbert)), Björn Luchterhandt ([@bjoluc](https://github.com/bjoluc)), and Jade ([@
|
|
64
|
+
The project is currently managed by the core team of Josh de Leeuw ([@jodeleeuw](https://github.com/jodeleeuw)), Becky Gilbert ([@becky-gilbert](https://github.com/becky-gilbert)), Björn Luchterhandt ([@bjoluc](https://github.com/bjoluc)), and Jade ([@jadeddelta](https://github.com/jadeddelta)).
|
|
65
65
|
|
|
66
66
|
jsPsych was created by [Josh de Leeuw](https://www.vassar.edu/faculty/jdeleeuw).
|
|
67
67
|
|
package/dist/index.browser.js
CHANGED
|
@@ -51,7 +51,7 @@ var jsPsychModule = (function (exports) {
|
|
|
51
51
|
|
|
52
52
|
var autoBind$1 = /*@__PURE__*/getDefaultExportFromCjs(autoBind);
|
|
53
53
|
|
|
54
|
-
var version = "8.2.
|
|
54
|
+
var version = "8.2.3";
|
|
55
55
|
|
|
56
56
|
class ExtensionManager {
|
|
57
57
|
constructor(dependencies, extensionsConfiguration) {
|
|
@@ -1016,10 +1016,35 @@ var jsPsychModule = (function (exports) {
|
|
|
1016
1016
|
return this.microphone_recorder;
|
|
1017
1017
|
}
|
|
1018
1018
|
initializeCameraRecorder(stream, opts) {
|
|
1019
|
+
let mimeType = this.getCompatibleMimeType() || "video/webm";
|
|
1020
|
+
const recorderOptions = {
|
|
1021
|
+
...opts,
|
|
1022
|
+
mimeType
|
|
1023
|
+
};
|
|
1019
1024
|
this.camera_stream = stream;
|
|
1020
|
-
const recorder = new MediaRecorder(stream,
|
|
1025
|
+
const recorder = new MediaRecorder(stream, recorderOptions);
|
|
1021
1026
|
this.camera_recorder = recorder;
|
|
1022
1027
|
}
|
|
1028
|
+
// mimetype checking code adapted from https://github.com/lookit/lookit-jspsych/blob/develop/packages/record/src/videoConfig.ts#L673-L699
|
|
1029
|
+
/** returns a compatible mimetype string, or null if none from the array are supported. */
|
|
1030
|
+
getCompatibleMimeType() {
|
|
1031
|
+
const types = [
|
|
1032
|
+
// chrome firefox edge
|
|
1033
|
+
"video/webm;codecs=vp9,opus",
|
|
1034
|
+
"video/webm;codecs=vp8,opus",
|
|
1035
|
+
// general
|
|
1036
|
+
"video/mp4;codecs=avc1.42E01E,mp4a.40.2",
|
|
1037
|
+
// safari
|
|
1038
|
+
"video/mp4;codecs=h264,aac",
|
|
1039
|
+
"video/mp4;codecs=hevc,aac"
|
|
1040
|
+
];
|
|
1041
|
+
for (const mimeType of types) {
|
|
1042
|
+
if (MediaRecorder.isTypeSupported(mimeType)) {
|
|
1043
|
+
return mimeType;
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
return null;
|
|
1047
|
+
}
|
|
1023
1048
|
getCameraStream() {
|
|
1024
1049
|
return this.camera_stream;
|
|
1025
1050
|
}
|
|
@@ -3402,6 +3427,73 @@ var jsPsychModule = (function (exports) {
|
|
|
3402
3427
|
}
|
|
3403
3428
|
}
|
|
3404
3429
|
});
|
|
3430
|
+
if (!parameterConfig.array && parameterValue !== null) {
|
|
3431
|
+
switch (parameterConfig.type) {
|
|
3432
|
+
case ParameterType.BOOL:
|
|
3433
|
+
if (typeof parameterValue !== "boolean") {
|
|
3434
|
+
const parameterPathString = parameterPathArrayToString(parameterPath);
|
|
3435
|
+
console.warn(
|
|
3436
|
+
`A non-boolean value (\`${parameterValue}\`) was provided for the boolean parameter "${parameterPathString}" in the "${this.pluginInfo.name}" plugin.`
|
|
3437
|
+
);
|
|
3438
|
+
}
|
|
3439
|
+
break;
|
|
3440
|
+
// @ts-ignore falls through
|
|
3441
|
+
case ParameterType.KEYS:
|
|
3442
|
+
if (Array.isArray(parameterValue)) break;
|
|
3443
|
+
case ParameterType.STRING:
|
|
3444
|
+
case ParameterType.HTML_STRING:
|
|
3445
|
+
case ParameterType.KEY:
|
|
3446
|
+
case ParameterType.AUDIO:
|
|
3447
|
+
case ParameterType.VIDEO:
|
|
3448
|
+
case ParameterType.IMAGE:
|
|
3449
|
+
if (typeof parameterValue !== "string") {
|
|
3450
|
+
const parameterPathString = parameterPathArrayToString(parameterPath);
|
|
3451
|
+
console.warn(
|
|
3452
|
+
`A non-string value (\`${parameterValue}\`) was provided for the parameter "${parameterPathString}" in the "${this.pluginInfo.name}" plugin.`
|
|
3453
|
+
);
|
|
3454
|
+
}
|
|
3455
|
+
break;
|
|
3456
|
+
case ParameterType.FLOAT:
|
|
3457
|
+
case ParameterType.INT:
|
|
3458
|
+
if (typeof parameterValue !== "number") {
|
|
3459
|
+
const parameterPathString = parameterPathArrayToString(parameterPath);
|
|
3460
|
+
console.warn(
|
|
3461
|
+
`A non-numeric value (\`${parameterValue}\`) was provided for the numeric parameter "${parameterPathString}" in the "${this.pluginInfo.name}" plugin.`
|
|
3462
|
+
);
|
|
3463
|
+
}
|
|
3464
|
+
break;
|
|
3465
|
+
case ParameterType.FUNCTION:
|
|
3466
|
+
if (typeof parameterValue !== "function") {
|
|
3467
|
+
const parameterPathString = parameterPathArrayToString(parameterPath);
|
|
3468
|
+
console.warn(
|
|
3469
|
+
`A non-function value (\`${parameterValue}\`) was provided for the function parameter "${parameterPathString}" in the "${this.pluginInfo.name}" plugin.`
|
|
3470
|
+
);
|
|
3471
|
+
}
|
|
3472
|
+
break;
|
|
3473
|
+
case ParameterType.SELECT:
|
|
3474
|
+
if (!parameterConfig.options) {
|
|
3475
|
+
const parameterPathString = parameterPathArrayToString(parameterPath);
|
|
3476
|
+
console.warn(
|
|
3477
|
+
`The "options" array is required for the "select" parameter "${parameterPathString}" in the "${this.pluginInfo.name}" plugin.`
|
|
3478
|
+
);
|
|
3479
|
+
}
|
|
3480
|
+
}
|
|
3481
|
+
if (parameterConfig.type === ParameterType.INT && parameterValue % 1 !== 0) {
|
|
3482
|
+
const parameterPathString = parameterPathArrayToString(parameterPath);
|
|
3483
|
+
console.warn(
|
|
3484
|
+
`A float value (\`${parameterValue}\`) was provided for the integer parameter "${parameterPathString}" in the "${this.pluginInfo.name}" plugin. The value will be truncated to an integer.`
|
|
3485
|
+
);
|
|
3486
|
+
parameterValue = Math.trunc(parameterValue);
|
|
3487
|
+
}
|
|
3488
|
+
}
|
|
3489
|
+
if (parameterConfig.type === ParameterType.SELECT) {
|
|
3490
|
+
if (!parameterConfig.options.includes(parameterValue)) {
|
|
3491
|
+
const parameterPathString = parameterPathArrayToString(parameterPath);
|
|
3492
|
+
console.warn(
|
|
3493
|
+
`The value "${parameterValue}" is not a valid option for the parameter "${parameterPathString}" in the "${this.pluginInfo.name}" plugin. Valid options are: ${parameterConfig.options.join(", ")}.`
|
|
3494
|
+
);
|
|
3495
|
+
}
|
|
3496
|
+
}
|
|
3405
3497
|
if (parameterConfig.array && !Array.isArray(parameterValue)) {
|
|
3406
3498
|
const parameterPathString = parameterPathArrayToString(parameterPath);
|
|
3407
3499
|
throw new Error(
|
|
@@ -4051,4 +4143,4 @@ var jsPsychModule = (function (exports) {
|
|
|
4051
4143
|
|
|
4052
4144
|
})({});
|
|
4053
4145
|
var initJsPsych = jsPsychModule.initJsPsych;
|
|
4054
|
-
//# sourceMappingURL=https://unpkg.com/jspsych@8.2.
|
|
4146
|
+
//# sourceMappingURL=https://unpkg.com/jspsych@8.2.3/dist/index.browser.js.map
|