costum audio-audio plugin #3151
Replies: 1 comment
-
I removed some unused functions and it works! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi all,
I am trying to merge the "html-audio-response" plugin and the "audio-button-response" plugin to create a plugin which allows audio file as stimulus and records audio response. Also, I want to initiate the recording as soon as the trial begins. This is the first time I try to modify plugin codes and unsurprisingly I get errors. The audio files play as I expect, but the recording does not seem to work. The script is not saving the recording to the data.
I share my codes below:
`var jsPsychAudioAudioResponse = (function (jspsych) {
'use strict';
const info = {
name: "audio-audio-response",
parameters: {
/** The audio file to be displayed /
audio_stimulus: {
type: jspsych.ParameterType.AUDIO,
pretty_name: "Audio_Stimulus",
default: undefined,
},
/* Any content here will be displayed on the screen. /
prompt: {
type: jspsych.ParameterType.HTML_STRING,
pretty_name: "Prompt",
default: null,
},
/* How long to show the trial. /
recording_duration: {
type: jspsych.ParameterType.INT,
default: 2000,
},
/* Whether or not to show a button to end the recording. If false, the recording_duration must be set. /
show_done_button: {
type: jspsych.ParameterType.BOOL,
default: true,
},
/* Label for the done (stop recording) button. Only used if show_done_button is true. /
done_button_label: {
type: jspsych.ParameterType.STRING,
default: "Continue",
},
/* Label for the record again button (only used if allow_playback is true). /
record_again_button_label: {
type: jspsych.ParameterType.STRING,
default: "Record again",
},
/* Label for the button to accept the audio recording (only used if allow_playback is true). /
accept_button_label: {
type: jspsych.ParameterType.STRING,
default: "Continue",
},
/* Whether or not to allow the participant to playback the recording and either accept or re-record. /
allow_playback: {
type: jspsych.ParameterType.BOOL,
default: false,
},
/* Whether or not to save the video URL to the trial data. /
save_audio_url: {
type: jspsych.ParameterType.BOOL,
default: false,
},
},
};
/*
*/
class AudioAudioResponsePlugin {
constructor(jsPsych) {
this.jsPsych = jsPsych;
this.rt = null;
this.recorded_data_chunks = [];
// this.on_load = this.on_load.bind(this);
}
AudioAudioResponsePlugin.info = info;
return AudioAudioResponsePlugin;
})(jsPsychModule);
`
Thank you in advance for your help!
Zifeng
Beta Was this translation helpful? Give feedback.
All reactions