Reply To: Event segmentation task

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

#7240
Jeremy
Keymaster

Hi Diana,

1) I am not sure what you mean by FPS. It usually means “frames per second,” which is a measure of how “dense” is video rendering: the denser (higher FPS) the more fluid the video appears, the less dense (lower FPS) the jerkier the video appears. Do you mean using frame numbers instead of seconds to point to positions in the video? I’m not sure it is feasible, and if it is, it wouldn’t be easy. More importantly, I strongly suspect that your participants will have a hard time understanding how to use this alternative cursor, when all they’re given (and which they most likely are already familiar with) are timecodes of the form MM:ss:mm (MM for minutes, mm for milliseconds). I do think using unrounded seconds would be the most straightforward way to go

2) In this case PennController will not give you all you need for what you want to do out of the box. You will need to create as many new elements as the participant needs, not just elements named “…1” and “…2” as you have now. PennController interprets the newX commands at the beginning of the experiment and not at runtime, so you cannot just use newX to dynamically create an indefinite number of new elements. You would need to wrap those newX commands in Function elements, so they can be interpreted during runtime. Here’s a very simplified illustration of the concept, not actually using a Video element for simplicity:

newTrial(
    newCanvas("container", "auto", "auto").print()
    ,
    newScale("dummy", 100).slider().print(getCanvas("container"))
    ,
    newVar("time", -1),
    newVar("times", []).log()
    ,
    newFunction( () => document.querySelector(".PennController-dummy input").addEventListener("change", e=>{
        getVar("time").set(e.target.value)._runPromises();
        const textSpan = document.querySelector(".PennController-Text-container:last-child span");
        textSpan.innerHTML = textSpan.innerHTML.replace(/<strong>.*<\/strong>$/, "<strong>"+e.target.value+"</strong>");
    }) ).call()
    ,
    newButton("Add a segment")
        .callback( 
            getVar("time").testNot.is(v=>v<0).success( getVar("times").set(v=>[...v,getVar("time").value]) )
            ,
            newFunction( ()=>new Promise(r => 
                newText("The natural ending for the first meaningful event would be at: <strong></strong>")
                    .print(getCanvas("container"))
                    ._runPromises().then(r)
            )).call()
        )
        .print()
        .click() // start with one segment already
    ,
    newButton("Finish").print().wait()
    ,
    getVar("time").testNot.is(v=>v<0).success( getVar("times").set(v=>[...v,getVar("time").value]) )
)

Note that in this example, you get warning about creating new Function and Text elements with the same names, but those are not fatal to the execution of the program

Jeremy