voicerecorder.waitVoiceRecorder element

getVoiceRecorder(id).wait()

or getVoiceRecorder(id).wait("first")

or getVoiceRecorder(id).wait("playback") (since PennController 1.1)

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.

If you pass “playback”, the commands that come next will only be evaluated and executed next time a recording has finished playing back via a click on the triangle-play button.

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:

PennController.InitiateRecorder("https://myserver/upload.php");

PennController(
    newVoiceRecorder("recorder")
        .settings.once()
        .print()
        .wait()
        .play()
        .wait("playback")
)

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.