PennController for IBEX › Forums › Support › Event segmentation task › Reply To: Event segmentation task
August 12, 2021 at 1:55 pm
#7168
Jeremy
Keymaster
Hello Diana,
You could use a Function element to detect seeking
events on the video and perform operations accordingly
Here is a suggestion — I also reworked the print
logic, because the visual arrangement appeared off for me
Template ("all_4_no_interference_fam_lang_task.csv", row => newTrial("segmentation_task", defaultText.css({'white-space': 'nowrap', margin: '0.5em'}).center() , newText("info1", "<p>If you were to divide this movie into meaningful events, at which second would the first meaninful event intuitively end?</p>") .bold() .print() , newTimer("wait", 3000).start().wait() , newVideo("video", row.video) .size("40vw", "23vw") .print() .play() .wait() .log() , newTooltip("tips", "Use the navigation bar to provide your answer") .label("Okay") .position("right middle") .size(200,"auto") .print( getVideo("video") ) , newText("lenght_label", "The natural ending for the first meaningful event would be at: ") .after( newText("seconds_label1", "...") ) .print() , newVar("ending times", [0]).log() // This .log() is somewhat redundant with video.log() , newFunction( ()=>new Promise(r=>getVideo("video")._element.video.addEventListener("seeking", async e=>{ await getVar("ending times").set(v=>[...v.slice(0,-1),e.target.currentTime])._runPromises(); await getText("seconds_label"+getVar("ending times").value.length).text( Math.round(e.target.currentTime) + " seconds." )._runPromises(); r(); })) ).call() , newDropDown("slider2", "(Select an option)") .add("Yes","No") .before(newText("question", "Do you think a new event begins right after the previous one?") ) .cssContainer("margin", "0.5em") .center() .print() .log() .wait() .test.selected("Yes") .success( getTooltip("tips").print( getVideo("video") ) , getVar("ending times").set(v=>[...v,[0]]) , newText("lenght_label", "The next meaningful event begins at: ") .after( newText("seconds_label2", "...") ) .print() , newFunction(()=>new Promise(r=>getVideo("video")._element.video.addEventListener("seeking", r))).call() ) , newText("instructions", "Please briefly describe the contents of the video!") .print() , newTextInput("description", "") .log() .lines(0) .size(500, 100) .center() .print() , newButton("Next") .css({ "background-color": "green", "font-size": "24px", "border-radius": "15px", padding: "15px 25px", "text-align": "center", color: "#fff", border: "none" }) .center() .print() .wait() ) .log("condition",row.condition) .log("name",row.name) .log("goal",row.goal) .log("event",row.event) .log("bin",row.bin) .log("video",row.video) )
Jeremy