Pausing experiment

PennController for IBEX Forums Support Pausing experiment

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #6370
    penn_baby_lab
    Participant

    Hi Jeremy,

    We would like to incorporate a feature into our experiment where participants, either by clicking a constantly on-screen button or by pressing a certain key, can pause the experiment. However, we’d like it to finish the trial it’s on first, and then not move on to the next until the key/button is clicked/pressed again.

    Sorry if this was already answered elsewhere – I couldn’t find a similar question. Thanks as always!

    Best,

    Nikhil

    #6372
    Jeremy
    Keymaster

    Hi Nikhil,

    “Finish the trial” can mean vastly different things depending on your task and your desiderata. You’ll need to make decisions as to what, precisely, should happen with each element in your task when the button is clicked. A very radical and easy-to-implement option is to just drop everything altogether, all you need to do is print a button whose callback will call end:

    newButton("Stop").callback( end() ).print()

    You can use as many commands as you want in the callback, so if you need to do anything with your existing elements (eg. stop some audio playback) before ending the trial, just do it there too

    Let me know if you have questions as you implement your own solution

    Jeremy

    #6402
    penn_baby_lab
    Participant

    Hi Jeremy,

    As far as I can tell, this ends the experiment completely – any ideas on how we could pause it yet make it possible to resume the experiment in the same location again? Thanks so much!

    #6408
    Jeremy
    Keymaster

    Hi,

    Would you mind sharing the link to your experiment with me, either here or privately at support@pcibex.net? The end command only stops the current trial, so if it runs through the end of your experiment, it may be coming from an interaction with your specific design

    Oh and I forgot to address the “pause” component from your first message. One option is to add a Header that will pause execution if a Var element has been set to true when clicking the button, eg:

    Header(
      newVar("pause", false).global().test.is(true).success(
        newButton("Resume").print().wait().remove(),
        getVar("pause").set(false)
      )
    )

    Of course you also want to add getVar("pause").set(true) before end in the callback of your pause button

    Jeremy

    #6416
    penn_baby_lab
    Participant

    Email sent – thanks!

    #6418
    Jeremy
    Keymaster

    The problem was due to the MediaRecorder element not automatically stopping when the trial ends prematurely, causing the MediaRecorder element from the next trial to crash. The solution consisted in calling stop on the MediaRecorder element before calling end in the callback

    Jeremy

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.