Reply To: response while reproducing video

PennController for IBEX Forums Support response while reproducing video Reply To: response while reproducing video

#5269
Jeremy
Keymaster

Hello Sílvia,

Yes, you can use Key elements as usual. Just remember that the script runs top-down and pauses on every wait command. Here’s an example:

newTrial(
    newText("Press Space when you see another boat in the video").print()
    ,
    newButton("Watch video").print().wait().remove()
    ,
    newVideo("video", "https://upload.wikimedia.org/wikipedia/commons/4/4f/CanoeTacking.webm")
        .size("auto","60vh")
        .print()
        .play()
    ,
    newTimer("tooearly", 2500).start(),
    newTimer("toolate", 3500).start()
    ,
    newKey(" ").wait()
    ,
    getVideo("video").pause()
    ,
    getTimer("tooearly").test.ended()
        .and( getTimer("toolate").test.running() )
        .success( newText("Good job!").print() )
        .failure( newText("Too early, or too late!").print() )
    ,
    newButton("Next").print().wait()
)

Jeremy