mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 03:00:54 +00:00
add default mimeType
if none is specified
This commit is contained in:
parent
81612ff171
commit
1f535826a2
5
.changeset/sixty-ears-tan.md
Normal file
5
.changeset/sixty-ears-tan.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"jspsych": patch
|
||||
---
|
||||
|
||||
add a default `mimeType` of `"video/webm" to `initializeCameraRecorder()`
|
@ -507,8 +507,7 @@ None.
|
||||
|
||||
#### Description
|
||||
|
||||
Generates a `MediaRecorder` object from provided `MediaStream` and stores this for access via [`getCameraRecorder()`](#getcamerarecorder).
|
||||
|
||||
Generates a `MediaRecorder` object from provided `MediaStream` and stores this for access via [`getCameraRecorder()`](#getcamerarecorder). By default, `mimeType` is set to `"video/webm"`.
|
||||
#### Example
|
||||
|
||||
```javascript
|
||||
|
@ -13,7 +13,10 @@
|
||||
const jsPsych = initJsPsych({
|
||||
extensions: [
|
||||
{type: jsPsychExtensionRecordVideo}
|
||||
]
|
||||
],
|
||||
on_finish: function() {
|
||||
jsPsych.data.displayData();
|
||||
}
|
||||
});
|
||||
|
||||
const initCamera = {
|
||||
|
@ -284,6 +284,12 @@ export class MediaAPI {
|
||||
private camera_recorder: MediaRecorder = null;
|
||||
|
||||
initializeCameraRecorder(stream: MediaStream, opts?: MediaRecorderOptions) {
|
||||
if (!opts) {
|
||||
opts = { mimeType: "video/webm" };
|
||||
} else if (!opts.mimeType) {
|
||||
opts.mimeType = "video/webm";
|
||||
}
|
||||
|
||||
this.camera_stream = stream;
|
||||
const recorder = new MediaRecorder(stream, opts);
|
||||
this.camera_recorder = recorder;
|
||||
|
Loading…
Reference in New Issue
Block a user