@lookit/record 3.0.0 → 3.0.1
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 +125 -39
- package/dist/index.browser.js +30 -4
- package/dist/index.browser.js.map +1 -1
- package/dist/index.browser.min.js +13 -13
- package/dist/index.browser.min.js.map +1 -1
- package/dist/index.cjs +29 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +17 -0
- package/dist/index.js +29 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/recorder.spec.ts +88 -1
- package/src/recorder.ts +8 -1
- package/src/videoConfig.spec.ts +115 -0
- package/src/videoConfig.ts +38 -1
package/dist/index.cjs
CHANGED
|
@@ -8,7 +8,7 @@ var Handlebars = require('handlebars');
|
|
|
8
8
|
|
|
9
9
|
var _package = {
|
|
10
10
|
name: "@lookit/record",
|
|
11
|
-
version: "3.0.
|
|
11
|
+
version: "3.0.1",
|
|
12
12
|
description: "Recording extensions and plugins for CHS studies.",
|
|
13
13
|
homepage: "https://github.com/lookit/lookit-jspsych#readme",
|
|
14
14
|
bugs: {
|
|
@@ -177,8 +177,10 @@ class Recorder {
|
|
|
177
177
|
this.blobs = [];
|
|
178
178
|
this.localDownload = "false"?.toLowerCase() === "true";
|
|
179
179
|
this.webcam_element_id = "lookit-jspsych-webcam";
|
|
180
|
+
this.mimeType = "video/webm";
|
|
180
181
|
this.streamClone = this.stream.clone();
|
|
181
182
|
autoBind(this);
|
|
183
|
+
this.mimeType = this.recorder?.mimeType || this.mimeType;
|
|
182
184
|
}
|
|
183
185
|
get recorder() {
|
|
184
186
|
return this.jsPsych.pluginAPI.getCameraRecorder() || this.jsPsych.pluginAPI.getMicrophoneRecorder();
|
|
@@ -196,7 +198,11 @@ class Recorder {
|
|
|
196
198
|
this._s3 = value;
|
|
197
199
|
}
|
|
198
200
|
initializeRecorder(stream, opts) {
|
|
199
|
-
|
|
201
|
+
const recorder_options = {
|
|
202
|
+
...opts,
|
|
203
|
+
mimeType: this.mimeType
|
|
204
|
+
};
|
|
205
|
+
this.jsPsych.pluginAPI.initializeCameraRecorder(stream, recorder_options);
|
|
200
206
|
}
|
|
201
207
|
reset() {
|
|
202
208
|
if (this.stream.active) {
|
|
@@ -640,6 +646,7 @@ class VideoConfigPlugin {
|
|
|
640
646
|
this.minVolume = 0.1;
|
|
641
647
|
this.micChecked = false;
|
|
642
648
|
this.processorNode = null;
|
|
649
|
+
this.mimeType = "video/webm";
|
|
643
650
|
this.addHtmlContent = (trial) => {
|
|
644
651
|
this.display_el.innerHTML = chsTemplates.videoConfig(trial, html_params);
|
|
645
652
|
};
|
|
@@ -782,7 +789,12 @@ class VideoConfigPlugin {
|
|
|
782
789
|
return { cameras: unique_cameras, mics: unique_mics };
|
|
783
790
|
};
|
|
784
791
|
this.initializeAndCreateRecorder = (stream, opts) => {
|
|
785
|
-
this.
|
|
792
|
+
this.mimeType = this.getCompatibleMimeType() || this.mimeType;
|
|
793
|
+
const recorder_options = {
|
|
794
|
+
...opts,
|
|
795
|
+
mimeType: this.mimeType
|
|
796
|
+
};
|
|
797
|
+
this.jsPsych.pluginAPI.initializeCameraRecorder(stream, recorder_options);
|
|
786
798
|
this.recorder = new Recorder(this.jsPsych);
|
|
787
799
|
};
|
|
788
800
|
this.checkMic = async (minVol = this.minVolume) => {
|
|
@@ -935,6 +947,20 @@ class VideoConfigPlugin {
|
|
|
935
947
|
};
|
|
936
948
|
});
|
|
937
949
|
}
|
|
950
|
+
getCompatibleMimeType() {
|
|
951
|
+
const mime_types = [
|
|
952
|
+
"video/webm;codecs=vp9,opus",
|
|
953
|
+
"video/webm;codecs=vp8,opus"
|
|
954
|
+
];
|
|
955
|
+
let mime_type_index = 0;
|
|
956
|
+
while (mime_type_index < mime_types.length) {
|
|
957
|
+
if (MediaRecorder.isTypeSupported(mime_types[mime_type_index])) {
|
|
958
|
+
return mime_types[mime_type_index];
|
|
959
|
+
}
|
|
960
|
+
mime_type_index++;
|
|
961
|
+
}
|
|
962
|
+
return null;
|
|
963
|
+
}
|
|
938
964
|
}
|
|
939
965
|
VideoConfigPlugin.info = info;
|
|
940
966
|
|