Skip to content

Commit 54a9014

Browse files
committed
expand docs to clarify common mimetypes
1 parent d258a29 commit 54a9014

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

docs/plugins/initialize-camera.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ button_label | string | 'Use this camera.' | The label for the select button.
2222
include_audio | bool | false | Set to `true` to include an audio track in the recordings.
2323
width | int | null | Request a specific width for the recording. This is not a guarantee that this width will be used, as it depends on the capabilities of the participant's device. Learn more about `MediaRecorder` constraints [here](https://developer.mozilla.org/en-US/docs/Web/API/Media_Streams_API/Constraints#requesting_a_specific_value_for_a_setting).
2424
height | int | null | Request a specific height for the recording. This is not a guarantee that this height will be used, as it depends on the capabilities of the participant's device. Learn more about `MediaRecorder` constraints [here](https://developer.mozilla.org/en-US/docs/Web/API/Media_Streams_API/Constraints#requesting_a_specific_value_for_a_setting).
25-
mime_type | string | null | Set this to use a specific [MIME type](https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder/mimeType) for the recording. Set the entire type, e.g., `'video/mp4; codecs="avc1.424028, mp4a.40.2"'`.
25+
mime_type | string | null | Set this to use a specific [MIME type](https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder/mimeType) for the recording. Set the entire type, e.g., `'video/mp4; codecs="avc1.424028, mp4a.40.2"'`. When provided with the default value of `null`, jsPsych will search for a compatible container/codec combination, with [common types listed here](../reference/jspsych-pluginAPI.md#initializecamerarecorder). If none are found, jsPsych will default to `'video/webm'` as the MIME type.
2626

2727

2828
## Data Generated

docs/reference/jspsych-pluginAPI.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,10 @@ None.
507507

508508
#### Description
509509

510-
Generates a `MediaRecorder` object from provided `MediaStream` and stores this for access via [`getCameraRecorder()`](#getcamerarecorder). By default, `mimeType` is set to `"video/webm"`.
510+
Generates a `MediaRecorder` object from provided `MediaStream` and stores this for access via [`getCameraRecorder()`](#getcamerarecorder). By default, `mimeType` is set to the first compatible container/codec combination found in a list of common types, or `"video/webm"` if no supported combination is found.
511+
512+
The common container/codec combinations that jsPsych checks for are `"video/webm;codecs=vp9,opus"`, `"video/webm;codecs=vp8,opus"`, `"video/mp4;codecs=avc1.42E01E,mp4a.40.2"`, `"video/mp4;codecs=h264,aac"`, and `"video/mp4;codecs=hevc,aac"`.
513+
511514
#### Example
512515

513516
```javascript

packages/jspsych/src/modules/plugin-api/MediaAPI.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ export class MediaAPI {
303303
"video/webm;codecs=vp9,opus",
304304
"video/webm;codecs=vp8,opus",
305305
// general
306-
'video/mp4; codecs="avc1.42E01E, mp4a.40.2"',
306+
"video/mp4;codecs=avc1.42E01E,mp4a.40.2",
307307
// safari
308308
"video/mp4;codecs=h264,aac",
309309
"video/mp4;codecs=hevc,aac",

0 commit comments

Comments
 (0)