import { ParameterType } from 'jspsych'; import html from '../utils/html.js'; const info = { name: "transcribe-call", parameters: { }, }; class jsPsychTranscribeCall { constructor(jsPsych) { this.jsPsych = jsPsych; } static { this.info = info; } trial(display_element, trial) { // Get the original recording data from the record-call trial // Look through recent trials to find one with recording response const allData = this.jsPsych.data.get(); const recentTrials = allData.trials.slice(-10); // Look at last 10 trials let recordingData = null; for (let i = recentTrials.length - 1; i >= 0; i--) { const trial = recentTrials[i]; if (trial.response && typeof trial.response === 'string' && trial.response.length > 100) { // Found a trial with audio recording data recordingData = trial; break; } } if (!recordingData || !recordingData.response) { display_element.innerHTML = `
No recording found from the previous trial.
Error loading audio data.