voicerecorder.waitVoiceRecorder element

getVoiceRecorder(id).wait()

Waits for the current (or next) recording to be over.

If you pass “first” and a recording had already been done by the time this command get evaluated and executed, the commands that come next are immediately evaluated and executed. Otherwise, it waits until a recording is over before evaluating and executing the next commands.

You can also pass a test command, in which case the next commands will be evaluated and executed upon completion of a recording while the condition of the test is satisfied. It it is not satisfied, then it will be checked again next time a recording is over.

Example:

[js highlight=”7,9″ try=”data”]PennController.InitiateRecorder(“https://myserver/upload.php”);

PennController(
newVoiceRecorder(“recorder”)
.settings.once()
.print()
.wait()
.play()
.wait(“playback”)[/js]

Adds a recording and a playback button to the page, and when the recording button is clicked for the second time (i.e., recording is over) the audio automatically plays back.