Reply To: Event segmentation task

PennController for IBEX Forums Support Event segmentation task Reply To: Event segmentation task

#7238
diana.gomz
Participant

Hello Jeremy,

Thanks again for the code. I have two more questions about this project (https://farm.pcibex.net/r/TViLxy/):

1) Is it possible to use fps instead of seconds? Since our videos are quite short, we realized it doesn’t make much sense to use seconds. We could still use unrounded numbers or maybe calculate fps afterwards, but just in case.

2) Would it be possible to create a loop to be able to ask participants to segment the videos as many times as they see fit? Here’s one of my failed attempts:

let launch = [
    getVideo("video") .print() .play() .wait() .log() 
    , 
    getTooltip("tips") .print( getVideo("video") ) 
    , 
    getVar("ending times").set(v=>[...v,[0]]) 
    , 
    newText("length_label", "The next meaningful event begins at: ") .after( newText("seconds_label2", "...") ) .print()    
    , 
    newFunction(()=>new Promise(r=>getVideo("video")._element.video.addEventListener("seeking", r))).call() 
    ,
    getButton("That's about right") .print() .wait() .remove() 
    ,
    getText("info2").remove()
    ,
    getVideo("video").remove() 
    ,
    getText("length_label").remove() 
    , 
    getDropDown("dropdown")     
]
//This is the segmentation task:
Template ("all_4_no_interference_fam_lang_task.csv", 
    row => newTrial("segmentation_task", defaultText.css({'white-space': 'nowrap', margin: '0.5em'}).center() , 
        newText("info1", "At which second would the first meaningful event of this movie intuitively end?") .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("length_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() 
        ,
        newButton("That's about right") .css({ "background-color": "green", "font-size": "24px", "border-radius": "15px", padding: "15px 25px", "text-align": "center", color: "#fff", border: "none" }) .center() .print() .wait() .remove() 
        ,
        getText("info1").remove()
        ,
        getVideo("video").remove() 
        ,
        getText("length_label").remove() 
        , 
        newDropDown("dropdown", "(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() 
        	.wait( )
        	    .test.selected("No") 
        	        .failure (newText("info2", "At which second would the next meaningful event of this movie intuitively begin?") .bold() .print() 
        	                   , 
        	                   newTimer("wait", 3000).start().wait() 
        	                   , 
        	                   ...launch) 
        ,
        newText("description", "Please briefly describe the contents of the movie.") .print() 
        , 
        newTextInput("description", "") .log() .lines(0) .size(500, 100) .center() .print() 
        , 
        newButton("Next movie") .css({ "background-color": "green", "font-size": "24px", "border-radius": "15px", padding: "15px 25px", "text-align": "center", color: "#fff", border: "none" }) .center() .print() .wait(getTextInput("description").testNot.text("")) 
    )  
    .log("condition",row.condition) .log("name",row.name) .log("goal",row.goal) .log("event",row.event) .log("bin",row.bin) .log("video",row.video) 
) 

Thank you again,
Diana