PennController for IBEX › Forums › Support › Help with recording audio? › Reply To: Help with recording audio?
May 12, 2023 at 8:22 am
#10576

Participant
Hi, @Jeremy! Considering the error message, is is possible to put a trial before that?
My idea was: If I cannot change the text, then I’ll display a warning to the kid “Please, wait your teacher”, so that the kid/participant calls the teacher, who will press S and then the message shows up. I tried to do it like this, but the order isn’t changing:
// 👉 Experimental trial:
Template("new--Items_Wide.csv", row =>
newTrial("listOfWords",
fullscreen() //enable full screen
,
newMediaRecorder("recorder", "audio").log().record()
,
newTimer("recording", 3000).log().start() // Start the timer now
,
newText("words", row.Column1.split('_').join("<br>")) // separate each word with a <br> tag (new line)
.cssContainer({
padding: '0.5em', // add some to not get too close to the border
'text-align': 'center', // trying to make the words center on fullscreen -- NOT WORKING :(
"justify-content": 'center',
"align-items": 'center' ,
'font-size': '50px',
})
.print()
,
newKey("NEXT", " ")
.callback( // use a callback to execute this in parallel to waiting for the timer
getKey("NEXT").remove() // remove the NEXT button
,
getText("words").text( row.Column2.split('_').join("<br>") ) // update the displayed list of words
)
.print()
// do not wait for a click, otherwise the timer might elapse before the click
,
getTimer("recording").wait() // wait for the timer to end
,
getMediaRecorder("recorder").stop()
,
getKey("NEXT").remove() // make sure to remove the button, in case the participant didn't get to the second list
,
getText("words").remove()
,
newText('time-is-up-msg', "Time is up!").print()
,
newButton('btn--finish--game', 'Finish Game').print().wait()
)
);
// 👉 Completion screen -- WAIT THE TEACHER ///////////////////////////////////////// HERE
newTrial("completion_screen",
// Exit fullscreen:
exitFullscreen()
,
// Print thank-you msg:
newText("thankyou-msg", "Good job, now wait your teacher!")
.center()
.print()
,
newKey("NEXT", "S")
// ,
// newButton("void", "")
// .wait()
);
// 👉 Send results:
SendResults();
// 👉 Check if promise is fullfilled
// 👉 Manually reject promise => insert dummy link
// 👉 Store audio locally
newTrial(
newFunction("check upload", ()=>PennController.uploadRecordingsError)
.test.is()
.success(
newText("confirmation", "The recordings were sent to the server. ")
.print()
)
.failure(
newText("error", "Click on the link below to store data 👇")
.color("red")
.print()
)
// ,
// newText("download-manually-msg", DownloadRecordingButton("Click here to download an archive of your recordings.") )
// .print()
// ,
// newTimer("inifinite", 0)
// .wait()
);