fix this reference

This commit is contained in:
Josh de Leeuw 2022-05-28 14:31:57 -04:00
parent a3b7d3453e
commit 1e2df37f8f

View File

@ -22,7 +22,9 @@ class RecordVideoExtension implements JsPsychExtension {
return; return;
} }
this.recorder.ondataavailable = this.handleOnDataAvailable; this.recorder.ondataavailable = (event) => {
this.handleOnDataAvailable(event);
};
}; };
on_load = () => { on_load = () => {
@ -32,7 +34,7 @@ class RecordVideoExtension implements JsPsychExtension {
on_finish = () => { on_finish = () => {
this.recorder.stop(); this.recorder.stop();
this.recorder.ondataavailable = null; //this.recorder.ondataavailable = null;
return { return {
record_video_data: new Blob(this.recordedChunks), record_video_data: new Blob(this.recordedChunks),
@ -41,6 +43,7 @@ class RecordVideoExtension implements JsPsychExtension {
private handleOnDataAvailable(event) { private handleOnDataAvailable(event) {
if (event.data.size > 0) { if (event.data.size > 0) {
console.log("chunks added");
this.recordedChunks.push(event.data); this.recordedChunks.push(event.data);
} }
} }