Hi, is it possible to take a screenshot with psychoJS like how psychopy has win.getMovieFrame()?
I have had this same question. When I try to use the win.saveMovieFrames() function online, I get the error that “win” is not defined in JS. Is there a workaround here?
I don’t know the answer to whether screenshots work online, but the reason for that error is that in JavaScript, you need to change some of the names that are used in Python scripts. e.g. win
should be referred to as psychoJS.window
Wakefield Carter maintains a useful resource for things like that here:
Thanks for the reply! I figured it had something to do with the JS vs Psychopy window call. The crib sheet was very useful, thank you. Following the crib sheet, I added a code component to my first routine as JS:
win = psychoJS.window
later I try to save the screenshot with the following code at the end of a routine:
win.getMovieFrame()
win.saveMovieFrames(‘screenshot.png’)
When I run online now, it’s still telling me that win.getMovieFrame is not a function. Attached is a minimized example. signature.psyexp (7.9 KB)
Hi, I was wondering whether you got this to work as I also would like to save screenshots at the end of each trial in PsychoJs. If you got this to work, could you please post the code that you used? Also, are the screenshots saved in each participant’s computer or on pavlovia?
Many thanks!
Unfortunately, this shouldn’t be possible at all becase JS does not allow screenshots to be made for security reasons.
EDIT: You could try this but I do not know wether it captures the PsychoPy canvas
Yeah, I could not get it to work. I was hoping to use this to obtain informed consent. But my IRB was ok with participants giving consent by pressing a specific key to begin the experiment, instead.