Saving trial duration into the Data /Pavlovia

URL of experiment: https://run.pavlovia.org/merve73/soa_temp_fixed/html

Description of the problem: Hi, I have a trial in which a video stim is played. The trial ends with the video ending. So the duration of both is actually the same. In each trial, an element of an array containing numbers from 6 to 9 is set as the duration of the video (and the trial). Since this is a temporal reproduction task, I need the duration of the video to compare it with the participants’ reproduction. So, I either can save the array and look at the variables in it since each variable is set as the trial duration in order or I can save the duration of the video itself. Yet, I do not know to do the neither one of these. So, do you have any idea how to save the duration of a video/trial or an array to the data?

Thank you all in advance.

If you are using a video stim component then save onset/offset times should be ticked by default.

However, you should also be able to save the duration of a routine using

thisExp.addData('Video duration',t) 

in the End Routine tab of a code component in your routine.

For this to work you will also need to add

thisExp=psychoJS.experiment;

to the Begin Experiment tab of code_JS (a JS only code component in your first routine) or switch your code to Both and replace thisExp with psychoJS.experiment manually.

Best wishes,

Wakefield

Somehow video duration is not saved automatically although save onset/offset is ticked. Yet, I am able to save the routine duration as you suggested. Thank you a lot!