Commit Graph

23 Commits

Author SHA1 Message Date
Josh de Leeuw
0ce8244c7d remove type for now 2024-07-15 17:08:32 -04:00
Josh de Leeuw
1229ed35f9 initial draft of AudioPlayer class 2023-11-02 16:12:37 -04:00
bjoluc
b9d58a67fb Merge branch 'main' into core-rewrite 2022-11-09 15:17:53 +01:00
bjoluc
8318d380c1 Merge branch 'main' into core-rewrite 2022-11-09 15:13:58 +01:00
Javier Vidal
89e2360073 Implement arrow functions on video and audio preload 2022-08-27 20:21:01 -07:00
Javier Vidal
334e320c9a Fix preload plugin error callback variable scope 2022-08-27 19:45:13 -07:00
Josh de Leeuw
936f589ed7 check if video buffer is already a blob when getting buffer (fixes #2704) 2022-07-13 09:28:16 -04:00
Josh de Leeuw
1381f575f5 option to turn on audio for video recordings 2022-07-12 10:33:27 -04:00
Josh de Leeuw
d36ab98f04 add getCameraStream to get the stream directly 2022-05-31 16:21:03 -04:00
Josh de Leeuw
7466fc6ee2 add mime type 2022-05-28 14:31:34 -04:00
Josh de Leeuw
ad3dcee9ff add camera recorder to pluginAPI 2022-05-27 16:25:53 -04:00
bjoluc
9ab889f38e Integrate timeline draft with JsPsych class 2022-01-27 23:33:33 +01:00
Josh de Leeuw
aa0d28f990 make default null 2021-11-23 15:24:17 -05:00
Josh de Leeuw
3a3d32971c start work on audio-input plugins 2021-11-19 17:00:10 -05:00
bjoluc
338c1b62b6 Merge branch 'modularization' into modularization-es6-stuff 2021-09-15 11:53:19 +02:00
Becky Gilbert
db754538b7
Convert plugins to classes and update examples (#2078)
* modularize plugins: edit index.ts and example files (WIP)

* continue modularizing plugins: edit index.ts and example files (WIP)

* continue modularizing plugins: edit index.ts and example files (WIP)

* continue modularizing plugins and example files, make info static in plugin classes

* add preload flag to plugin info, fix a few parameterType values

* change preload flags in plugin info from audio/image/video strings to boolean

* convert more plugins and example files

* convert more plugins/examples, sync with webgazer branch plugins/examples (not working on this branch)

* remove preload flag from info, change to ParameterType, change to "ALL_KEYS"/"NO_KEYS", change KEY type to KEYS for array params

* remove descriptions from plugin info, fix some ALL_KEYS/NO_KEYS errors

* remove descriptions and add pretty names to plugin info

* remove/edit comments re ALL_KEYS/NO_KEYS and TS errors

* fix some preload plugin errors and convert example file (plugin still not working due to getAutoPreloadList)

* convert RDK plugin and example file

* convert preload plugin and example, add JsPsych getTimelineDescription method for auto-preloading (still not working for audio due to getAudioBuffer

* fix jsPsych getTimelineDescription method so that it does recursive search

* add image and video preloading to plugin examples

* Merge branch 'modularization' into modularization-plugins

* add tests for reconstruction

* fix timeline array getter method: add private timelineDescription var, set to timeline array in run(), rename getTimelineDescription to getTimeline

* changes in response to PR review: fix JsDoc comments, fix array: true in param info, change HTML string param types, add JsDoc author/file/see docs for all plugin classes, switch to @ts-expect-error. Thanks @bjoluc!

* fix JsDoc comments for plugin classes and preload trials parameter

* change preload type to boolean in ParameterInfo interface, and add `preload: false` to virtual-chinrest item_path image parameter

* All my tests except for preload plugin (will do that tomorrow)

* minor fixes to reconstruction tests

* Update preload plugin tests

* Finish test conversion

* switch to arrow functions to fix this keyword errors in plugins, add audio preloading into plugin example files, fix typos

* convert non-plugin example files (WIP, not tested)

* Fix allow_held_keys -> allow_held_key parameter in virtual-chinrest plugin

* Fix `keyboardListener` type in serial-reaction-time plugin

* type fixes for RDK, simplifying `correctOrNot()` function

* fixed ["ALL_KEYS"] => "ALL_KEYS" for iat plugins and tests

* Build jspsych packages before everything else

Dependent builds were previously failing due to missing type definitions

* Remove console.log from html-keyboard-response tests

I think I accidentially committed it.

* fix the delayed start to animation bug (#1885)

* round all RTs to nearest int (#2108)

* fixes and tests #1900 - IAT parameter problems

* finish converting/testing example files, add init settings, add audio preloading, fix errors

* fix progress-bar timeline to demo an example where auto-updating the progress bar works well

* Revert "round all RTs to nearest int (#2108)"

This reverts commit f53145d2e3.

* change how delayed timeline variables are implemented

* use static for generate_stimulus method so that it can be called on the vsl-grid-scene class

* fix external-html plugin and example (switch to arrow function for proper this context, fix incorrect parameter name)

* remove outdated TO DO comments

Co-authored-by: bjoluc <mail@bjoluc.de>
Co-authored-by: Josh de Leeuw <josh.deleeuw@gmail.com>
2021-09-08 09:44:53 -04:00
Josh de Leeuw
c374991d17 update preloading methods to use es6 features 2021-08-25 11:20:53 -04:00
Josh de Leeuw
2224784219 replace utility method flatten() with es6 .flat() 2021-08-24 13:44:58 -04:00
bjoluc
0a8773204e Remove useWebaudio default value in MediaAPI constructor 2021-08-23 11:19:52 +02:00
bjoluc
c30b6ad19a Rework preloading in MediaAPI
This drops support for the `registerPreload()` function and instead
infers preloading information on the fly in `getAutoPreloadList()`.
2021-08-22 00:11:17 +02:00
bjoluc
bb141c446a Fix class instance access in callback functions
by converting the affected functions to arrow functions to preserve the
outer-scope `this`
2021-08-20 14:17:46 +02:00
bjoluc
c119650471 Move experiment execution into jsPsych.run()
The `run()` method takes a timeline and returns a promise that is
resolved when the experiment finishes.
Hence, jsPsych can now be initialized without starting an experiment.
This re-enables usage of `jsPsych.timelineVariable()` in timeline
definitions and repairs exclusion checks and extension loading.
2021-07-19 17:10:37 +02:00
bjoluc
8cfbba526a Use classes to avoid global state
Instead of a global `jsPsych` object, there is a `JsPsych` class now
which can be instantiated with the parameters that were previously
accepted by `jsPsych.init`. Upon instantiation, the `JsPsych` class also
instantiates classes for stateful modules (`jsPsych.data` and
`jsPsych.pluginAPI`) and passes relevant `JsPsych` instance information
to them. Plugins are expected to be classes now that are instantiated
for each trial and receive the `JsPsych` instance as their only
constructor argument.
2021-07-12 18:15:37 +02:00