PennController for IBEX › Forums › Support › Ensure the audio files have been played before moving on
Tagged: .test.hasPlayed, audio files
- This topic has 2 replies, 2 voices, and was last updated 3 years, 10 months ago by
gzlkj.
-
AuthorPosts
-
April 1, 2021 at 3:30 pm #6803
gzlkj
ParticipantHi,
I have two audio files in each trial and a selector element. I want to make sure the participants have clicked on the play button of the two files before selecting one of the options from the selector. My first idea was to use the .test.hasPlayed command in a wait condition for a button then move on to the selector element, but that resulted in having me click on the button twice. I might have other trials where there’s only one audio, but I thought there should be a better simpler solution for this that I’m not seeing in the documentation. Although I found this other post about clicking on buttons, I wasn’t sure how I could implement it similarly for this trial I have (code below):
newTrial ("practice" , newCanvas("audio", 800, 80) .add( 20, 18, newAudio("soundl", row.PL_Audio) ) .add( 500, 18, newAudio("soundr", row.PR_Audio) ) .print() .center() , newCanvas("pairs", 800, 200) .add( 80, 60, newText("left", row.PL) ) .add( 560, 60, newText("right", row.PR) ) .print() .center() , newSelector("comparison") .add( getText("left") , getText("right") ) .print() .wait() .log() .once() )
and I also wanted to say thanks for the effort you put in for making the new farm available. It’s amazing!
-Zara
April 1, 2021 at 3:43 pm #6804Jeremy
KeymasterHi Zara,
Using
.test.hasPlayed
sounds like a good idea, and there would be a way to make it work. But if you want to automatically move on to the Selector element immediately after the second audio has played back, there is a simpler way: just insertgetAudio("soundl").wait("first"),getAudio("soundr").wait("first")
before thenewSelector
line. Because of the"first"
argument, even if soundl is played after soundr, the twowait
s will be validated in a row because"first"
in the secondwait
will automatically detect that soundr was played back beforeLet me know if that worked
Jeremy
April 1, 2021 at 5:47 pm #6807gzlkj
ParticipantThank you! It looks like it’s working as it should.
I really appreciate the quick reply, that was helpful. I’ve seen the “first” argument somewhere in the documentation of the old farm before, but it didn’t occur to me that I can use it here. -
AuthorPosts
- You must be logged in to reply to this topic.