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 CHANGED
@@ -25,7 +25,7 @@ You can learn more about setting up a project by following the [hello world tuto
25
25
 
26
26
  Once you've got a project set up, the [reaction time task tutorial](https://www.jspsych.org/latest/tutorials/rt-task/) is a great next step, since it covers many core topics and features.
27
27
 
28
- There are also a number of [video tutorials](https://www.jspsych.org/latest/tutorials/video-tutorials) available on the website.
28
+ There are also a number of [community tutorials](https://www.jspsych.org/latest/tutorials/community-tutorials) available on the website.
29
29
 
30
30
  ## Examples
31
31
 
@@ -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.0";
54
+ var version = "8.2.2";
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, opts);
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
  }
@@ -3673,6 +3698,11 @@ var jsPsychModule = (function (exports) {
3673
3698
  this.turk = turk;
3674
3699
  this.randomization = randomization;
3675
3700
  this.utils = utils;
3701
+ // prettier-ignore
3702
+ this.citation = {
3703
+ "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 ",
3704
+ "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}, } '
3705
+ };
3676
3706
  /** Options */
3677
3707
  this.options = {};
3678
3708
  /**
@@ -3892,17 +3922,13 @@ var jsPsychModule = (function (exports) {
3892
3922
  */
3893
3923
  getCitations(plugins = [], format = "apa") {
3894
3924
  const formatOptions = ["apa", "bibtex"];
3895
- const jsPsychCitations = {
3896
- "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 ",
3897
- "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}, } '
3898
- };
3899
3925
  format = format.toLowerCase();
3900
3926
  if (!Array.isArray(plugins)) {
3901
3927
  throw new Error("Expected array of plugins/extensions");
3902
3928
  } else if (!formatOptions.includes(format)) {
3903
3929
  throw new Error("Unsupported citation format");
3904
3930
  } else {
3905
- const jsPsychCitation = jsPsychCitations[format];
3931
+ const jsPsychCitation = this.citation[format];
3906
3932
  const citationSet = /* @__PURE__ */ new Set([jsPsychCitation]);
3907
3933
  for (const plugin of plugins) {
3908
3934
  try {
@@ -4050,4 +4076,4 @@ var jsPsychModule = (function (exports) {
4050
4076
 
4051
4077
  })({});
4052
4078
  var initJsPsych = jsPsychModule.initJsPsych;
4053
- //# sourceMappingURL=https://unpkg.com/jspsych@8.2.0/dist/index.browser.js.map
4079
+ //# sourceMappingURL=https://unpkg.com/jspsych@8.2.2/dist/index.browser.js.map