PennController.DownloadVoiceButtonGlobal Commands

PennController.DownloadVoiceButton( text )

Generates a <button> that, when clicked, proposes to download a ZIP archive containing all the audio recordings collected during the experiment.

This should be used only after the recordings have been sent to the server you specified (see this page). You would typically send the results early with PennController.SendResults and show an exit page with the button after that.

Example:

[js highlight=”24″ try=”data”]PennController.InitiateRecorder(“https://myserver/uploadVoices/saveRecordings.php”);

PennController( “record” ,
newVoiceRecorder(“recorder”)
.print()
.wait()
);

PennController.SendResults();

PennController(
newFunction(“check upload”, ()=>PennController.uploadRecordingsError)
.test.is()
.success(
newText(“confirmation”, “The recordings were sent to the server. “)
.print()
)
.failure(
newText(“error”, “There was a problem sending the recordings to the server. “)
.settings.color(“red”)
.print()
)
,
newText(“download”, PennController.DownloadVoiceButton(“Click here to download an archive of your recordings.”) )
.print()
,
newTimer(“inifinite”, 0)
.wait()
);
[/js]

Invites the participant to make a voice recording and send the results to the server. In this case, we specified a dummy URL, so uploading the recordings will fail, and PennController.uploadRecordingsError will accordingly be defined. The last screen will inform the participant of the error (since PennController.uploadRecordingsError is not void/undefined) and will show a button to download an archive of the recordings.