jspsych 8.2.0 → 8.2.2
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 +34 -8
- package/dist/index.browser.js.map +1 -1
- package/dist/index.browser.min.js +6 -6
- package/dist/index.browser.min.js.map +1 -1
- package/dist/index.cjs +33 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +33 -7
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/JsPsych.ts +4 -3
- package/src/modules/plugin-api/MediaAPI.ts +28 -1
- package/src/timeline/Timeline.spec.ts +2 -2
- package/src/timeline/Trial.spec.ts +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4,7 +4,7 @@ var autoBind = require('auto-bind');
|
|
|
4
4
|
var rw = require('random-words');
|
|
5
5
|
var seedrandom = require('seedrandom/lib/alea.js');
|
|
6
6
|
|
|
7
|
-
var version = "8.2.
|
|
7
|
+
var version = "8.2.2";
|
|
8
8
|
|
|
9
9
|
class ExtensionManager {
|
|
10
10
|
constructor(dependencies, extensionsConfiguration) {
|
|
@@ -969,10 +969,35 @@ class MediaAPI {
|
|
|
969
969
|
return this.microphone_recorder;
|
|
970
970
|
}
|
|
971
971
|
initializeCameraRecorder(stream, opts) {
|
|
972
|
+
let mimeType = this.getCompatibleMimeType() || "video/webm";
|
|
973
|
+
const recorderOptions = {
|
|
974
|
+
...opts,
|
|
975
|
+
mimeType
|
|
976
|
+
};
|
|
972
977
|
this.camera_stream = stream;
|
|
973
|
-
const recorder = new MediaRecorder(stream,
|
|
978
|
+
const recorder = new MediaRecorder(stream, recorderOptions);
|
|
974
979
|
this.camera_recorder = recorder;
|
|
975
980
|
}
|
|
981
|
+
// mimetype checking code adapted from https://github.com/lookit/lookit-jspsych/blob/develop/packages/record/src/videoConfig.ts#L673-L699
|
|
982
|
+
/** returns a compatible mimetype string, or null if none from the array are supported. */
|
|
983
|
+
getCompatibleMimeType() {
|
|
984
|
+
const types = [
|
|
985
|
+
// chrome firefox edge
|
|
986
|
+
"video/webm;codecs=vp9,opus",
|
|
987
|
+
"video/webm;codecs=vp8,opus",
|
|
988
|
+
// general
|
|
989
|
+
"video/mp4;codecs=avc1.42E01E,mp4a.40.2",
|
|
990
|
+
// safari
|
|
991
|
+
"video/mp4;codecs=h264,aac",
|
|
992
|
+
"video/mp4;codecs=hevc,aac"
|
|
993
|
+
];
|
|
994
|
+
for (const mimeType of types) {
|
|
995
|
+
if (MediaRecorder.isTypeSupported(mimeType)) {
|
|
996
|
+
return mimeType;
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
return null;
|
|
1000
|
+
}
|
|
976
1001
|
getCameraStream() {
|
|
977
1002
|
return this.camera_stream;
|
|
978
1003
|
}
|
|
@@ -2312,6 +2337,11 @@ class JsPsych {
|
|
|
2312
2337
|
this.turk = turk;
|
|
2313
2338
|
this.randomization = randomization;
|
|
2314
2339
|
this.utils = utils;
|
|
2340
|
+
// prettier-ignore
|
|
2341
|
+
this.citation = {
|
|
2342
|
+
"apa": "de Leeuw, J. R., Gilbert, R. A., & Luchterhandt, B. (2023). jsPsych: Enabling an Open-Source Collaborative Ecosystem of Behavioral Experiments. Journal of Open Source Software, 8(85), 5351. https://doi.org/10.21105/joss.05351 ",
|
|
2343
|
+
"bibtex": '@article{Leeuw2023jsPsych, author = {de Leeuw, Joshua R. and Gilbert, Rebecca A. and Luchterhandt, Bj{\\" o}rn}, journal = {Journal of Open Source Software}, doi = {10.21105/joss.05351}, issn = {2475-9066}, number = {85}, year = {2023}, month = {may 11}, pages = {5351}, publisher = {Open Journals}, title = {jsPsych: Enabling an {Open}-{Source} {Collaborative} {Ecosystem} of {Behavioral} {Experiments}}, url = {https://joss.theoj.org/papers/10.21105/joss.05351}, volume = {8}, } '
|
|
2344
|
+
};
|
|
2315
2345
|
/** Options */
|
|
2316
2346
|
this.options = {};
|
|
2317
2347
|
/**
|
|
@@ -2531,17 +2561,13 @@ class JsPsych {
|
|
|
2531
2561
|
*/
|
|
2532
2562
|
getCitations(plugins = [], format = "apa") {
|
|
2533
2563
|
const formatOptions = ["apa", "bibtex"];
|
|
2534
|
-
const jsPsychCitations = {
|
|
2535
|
-
"apa": "de Leeuw, J. R., Gilbert, R. A., & Luchterhandt, B. (2023). jsPsych: Enabling an Open-Source Collaborative Ecosystem of Behavioral Experiments. Journal of Open Source Software, 8(85), 5351. https://doi.org/10.21105/joss.05351 ",
|
|
2536
|
-
"bibtex": '@article{Leeuw2023jsPsych, author = {de Leeuw, Joshua R. and Gilbert, Rebecca A. and Luchterhandt, Bj{\\" o}rn}, journal = {Journal of Open Source Software}, doi = {10.21105/joss.05351}, issn = {2475-9066}, number = {85}, year = {2023}, month = {may 11}, pages = {5351}, publisher = {Open Journals}, title = {jsPsych: Enabling an {Open}-{Source} {Collaborative} {Ecosystem} of {Behavioral} {Experiments}}, url = {https://joss.theoj.org/papers/10.21105/joss.05351}, volume = {8}, } '
|
|
2537
|
-
};
|
|
2538
2564
|
format = format.toLowerCase();
|
|
2539
2565
|
if (!Array.isArray(plugins)) {
|
|
2540
2566
|
throw new Error("Expected array of plugins/extensions");
|
|
2541
2567
|
} else if (!formatOptions.includes(format)) {
|
|
2542
2568
|
throw new Error("Unsupported citation format");
|
|
2543
2569
|
} else {
|
|
2544
|
-
const jsPsychCitation =
|
|
2570
|
+
const jsPsychCitation = this.citation[format];
|
|
2545
2571
|
const citationSet = /* @__PURE__ */ new Set([jsPsychCitation]);
|
|
2546
2572
|
for (const plugin of plugins) {
|
|
2547
2573
|
try {
|