Welcome!

Sign in with your CogSci, Facebook, Google, or Twitter account.

Or register to create a new account.

We'll use your information only for signing in to this forum.

Supported by

Log response dúring video

ABoelhouwerABoelhouwer Posts: 7
edited April 20 in OpenSesame

Hi everyone,

I am trying to get something fairly simple done, but i just cannot seem to get it to work.
I want to record any button presses dúring the playback of a video. I know i cannot do it throguh coroutine, and have tried it through inline script but just do not seem to get anywhere. I have gone through the manuals and tutorials.
Can anyone help me?

*Also i would like to continue to the next sequence after a button is pressed.

Comments

  • sebastiaansebastiaan Posts: 2,563

    Hi,

    Capturing key presses during video playback is quite straightforward. If you use the media_player_mpy, you can set duration to 'Sound' and 'Call custom code' to 'on keypress'. Once you've done that, your custom Python code is executed whenever a key is pressed.

    As explained in the media_player_mpy help file (which you get if you click on the item's help button), the events variable is either None or a type, value tuple. So you have all in the information you need.

    The snippet below prints out each event (i.e. each key press).

    print(event)
    if event is not None:
        event_type, event_value = event
        if event_type == 'key' and event_value == 'space':
            continue_playback = False
    

    But you also have to decide how you want key presses to be recorded. Do you want some kind of event-based log file? Or do you have something else in mind?

    Cheers!
    Sebastiaan

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.
    cogsci.nl/smathot

Sign In or Register to comment.