video looping

PennController for IBEX Forums Support video looping

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #6339
    karmacoma
    Participant

    Hi Jeremy,

    How can I make a video loop (until a key press is being made)? I know we can use play(“loop”) for audios, but I don’t think there’s one for video elements. Thank you!

    #6341
    Jeremy
    Keymaster

    Hi,

    You’re right, I should probably add the option to pass "loop" to the play command. In the meantime, here’s a script that’ll do what you want:

    newTrial(
        newVideo("turbine", "https://upload.wikimedia.org/wikipedia/commons/8/8f/Active_Lift_Turbine.ogv")
            .print()
        ,
        newVar("loop", true),
        newTimer("loop", 1)
            .callback( getVar("loop").test.is(true).success(
                getVideo("turbine").play().wait()
                ,
                getTimer("loop").start()
            ) )
            .start()
        ,
        newKey("Enter").wait()
        ,
        getVar("loop").set(false),
        getVideo("turbine").stop()
        ,
        newButton("Next").print().wait()
    )

    Let me know if you have questions

    Jeremy

    #6344
    karmacoma
    Participant

    Thank you Jeremy – that’s extremely helpful!

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.