Reply To: VoiceRecorder: block incomplete recording / authorization page

PennController for IBEX Forums Support VoiceRecorder: block incomplete recording / authorization page Reply To: VoiceRecorder: block incomplete recording / authorization page

#4988
Jeremy
Keymaster

Hi,

1. If you look at the documentation page for the VoiceRecorder element, you’ll see that there are two relevant commands: a wait command and a test.recorded command. I would favor the first one, using it like this:

newTrial(
  newVoiceRecorder("sample")
    .print()
    .wait()
  ,
  newButton("Next")
    .print()
    .wait()
)

Alternatively, you could use getVoiceRecorder("sample").test.recorded() in your button’s wait command to validate the click only if a recording is present.

2. You can partially customize the text by passing a string as the second parameter of InitiateRecorder. I should add an option to customize the consent text too, but in the meantime you can add this to your script:

let replaceConsentMic = ()=>{
        let consentLink = $(".PennController-PennController a.Message-continue-link");
        if (consentLink.length > 0 && consentLink[0].innerHTML.match(/^By clicking this link I understand that I grant this experiment's script access to my recording device/))
            consentLink.html("En cliquant sur ce lien je comprends que j'autorise le script de cette expérience à accéder à mon microphone...");
        else
            window.requestAnimationFrame( replaceConsentMic );
};
window.requestAnimationFrame( replaceConsentMic );

Of course you want to replace the French text with your own text.

Let me know if you have questions

Jeremy