PennController for IBEX › Forums › Support › response while reproducing video
- This topic has 4 replies, 2 voices, and was last updated 4 years, 5 months ago by sblanch.
-
AuthorPosts
-
May 17, 2020 at 4:17 am #5268sblanchParticipant
Good morning Jeremy
Is it possible to get keyboard or other response from participants while we are reproducing the videos?
We wanna have the participant reponse when something happens in our video …
Thanks again! thank you for your help and your quick response
Kind regards
SílviaMay 18, 2020 at 10:21 am #5269JeremyKeymasterHello 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
May 18, 2020 at 11:42 am #5270sblanchParticipantThank you Jeremy!
But it seems to work with just one response during the video, isn’t it? can we do like a while loop to look the responses during all the video? is it possible?
Thanks again!
SílviaMay 18, 2020 at 11:57 am #5272JeremyKeymasterI’m not sure a while loop would be the way to go, but maybe you’d want to use the callback command. It really depends on what design you have in mind. But again, there’s nothing special about playing back a video, really. Just code your trial the way you would code any other trial. Here’s another example:
newTrial( newText("Press Space whenever you see a second 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() .log() , newText("Number of presses on the Spacebar...") .after( newText("times", "0") ) .print() , newVar("presses", 0) , newKey(" ") .log("all") .callback( getVar("presses").set(v=>v+1), getText("times").text( getVar("presses") ) ) , getVideo("video").wait() , getVar("presses").test.is(2) .success( newText("Indeed, there were exactly two other boats").print() ) .failure( newText("Did you miss something, or did you see ghost boats?").print() ) , newButton("Next").print().wait() )
Jeremy
May 18, 2020 at 12:11 pm #5274sblanchParticipantThank you Jeremy!!!!!!
-
AuthorPosts
- You must be logged in to reply to this topic.