mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 11:10:54 +00:00
add docs for new pluginAPI features
This commit is contained in:
parent
aa0d28f990
commit
e2f843b27c
@ -325,6 +325,63 @@ jsPsych.pluginAPI.getAutoPreloadList(timeline);
|
||||
|
||||
---
|
||||
|
||||
### getMicrophoneRecorder
|
||||
|
||||
```javascript
|
||||
jsPsych.pluginAPI.getMicrophoneRecorder()
|
||||
```
|
||||
|
||||
#### Parameters
|
||||
|
||||
None
|
||||
|
||||
#### Return value
|
||||
|
||||
A `MediaRecorder` object connected to the `MediaStream` for the active microphone.
|
||||
|
||||
#### Description
|
||||
|
||||
Provides access to the `MediaRecorder` created by [initializeMicrophoneRecorder()](#initializemicrophonerecorder).
|
||||
If no microphone recorder exists, it returns `null`.
|
||||
|
||||
#### Example
|
||||
|
||||
```javascript
|
||||
const recorder = jsPsych.pluginAPI.getMicrophoneRecorder();
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### initializeMicrophoneRecorder
|
||||
|
||||
```javascript
|
||||
jsPsych.pluginAPI.initializeMicrophoneRecorder(stream)
|
||||
```
|
||||
|
||||
#### Parameters
|
||||
|
||||
Parameter | Type | Description
|
||||
----------|------|------------
|
||||
stream | `MediaStream` | The `MediaStream` object from an active microphone device.
|
||||
|
||||
#### Return value
|
||||
|
||||
None.
|
||||
|
||||
#### Description
|
||||
|
||||
Generates a `MediaRecorder` object from provided `MediaStream` and stores this for access via [getMicrophoneRecorder()](#getmicrophonerecorder).
|
||||
|
||||
#### Example
|
||||
|
||||
```javascript
|
||||
const stream = await navigator.mediaDevices.getUserMedia({ audio: { deviceId: mic_id } });
|
||||
|
||||
jsPsych.pluginAPI.initializeMicrophoneRecorder(stream);
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### preloadAudio
|
||||
|
||||
```javascript
|
||||
|
Loading…
Reference in New Issue
Block a user