Video playback and keyboard response
Hi everyone,
For my lexical decision task, I play a video clip and then collect a response (left for sign and right for nonsign) on the keyboard. The subject has 2500 ms to respond from the moment the video starts playing. Ideally, the moment the key is pressed, the next trial is called. When I set the timeout for the keyboard response as 2500 and the duration for the mpy as kepress, the video just freezes and then moves on to the next trial after the remaining time. I have to press the response keys twice to record the response and move on. I tried two variations:
1.The duration for mpy as 0- the video doesn't play, a single frame appears
2. The duration for the mpy as 2500- the same as when the timeout for keyboard is 2500.
What can I do? I need to record the response time from the moment the video plays and the time available to respond is 2500ms (the videos are all between 1000-2000ms)
Thanks!!!

Comments
Hi NikkieK, that sounds weird. I'm going to check it out and will get back to you shortly!
Hi NikkieK, I think I see what is going on now. The way you've set up your experiment indeed causes the experiment to pause at the keyboard_response item. What is happening is that when you press a key during video playback, this is registered as the response to the video item. After this, the keyboard_response item directly follows, expecting another response and pausing the experiment until it gets is.
I don't really have a simple solution to your problem. You will need to program the response handling yourself in the script section that the video player item provides. You can check http://osdoc.cogsci.nl/3.1/manual/python/responses/ for useful functions regarding setting responses. I haven't been able to check this myself, but a simple script like
in the video_player_item should do it. You will have to replace the media_player_mpy part in
time_media_player_mpywith the actual name you have given your video player item.Don't forget to set call custom Python code to
on keypressand remove the keyboard_response item after the video item.I hope this helps!
And I put 'keypress' in duration field for the media player still? Or the timeout that I want?
Hi Daniel,
Thanks for the help...! It solved the playback issue...but I still haven't figured out how to solve the timeout issue. I have tried various codes but still haven't solved it (still learning python by the way). What I want to do is to allow the participant 2500ms to respond from the moment the clip starts, so if the video completes playing a blank screen needs to be displayed for the remaining time until a response is given and if no response is given the experiment moves onto the next video.
Right, then I made a mistake in my last post. You should set call custom Python code to
after each frameand set timeout to 2500 ms. If my code is correct, it should only do something if a key is pressed.Hi Daniel...I have tried what you suggested but it doesnt seem to work. And I wanted to ask...for the blank screen to be displayed for the (2500-[length of the video])ms, do i put this in a separate inline_script or in the custom python code for the video? I am not sure because the blank screen needs to be able to collect responses as well..
If it doesn't work, can you please tell me what goes wrong? I need more information to know where I should look.
If the blank scren occurs after the video, then you can place it as a separate item behind the video item. You can control whether the blank screen need to appear with the
run ifdirectives you find in the sequence item.Hi @Daniel, I tried to run the solution of your first answer but it tells me that var.my_media_player_mpy(with name it has in my experiment) does not exist. why?