jsPsych icon indicating copy to clipboard operation
jsPsych copied to clipboard

fullscreen enter and exit

Open juliameehan opened this issue 4 years ago • 5 comments

I'm having the issue tracking fullscreen enter / exit where interaction data is not tracking reentering fullscreen, but only tracks the exit.

juliameehan avatar Mar 12 '21 04:03 juliameehan

Hi @juliameehan! Could you share a little more information about this so that we can try to reproduce it please? What version of jsPsych are you using? Does this happen on one particular browser or multiple?

becky-gilbert avatar Mar 12 '21 22:03 becky-gilbert

hi @becky-gilbert yes -- I am currently using version 6.2. This happens on both my safari and chrome browsers. I am just tracking and saving the interaction data in a csv and I can only see fullscreen enter when it starts in fullscreen and fullscreen exit the first time I exit. If I back into fullscreen and exit fullscreen later it does not track it. This is how I am saving the data: saveData(""+subjid+"_browser_interact_data", jsPsych.data.getInteractionData().csv()); Thanks!

juliameehan avatar Mar 14 '21 20:03 juliameehan

Hi @juliameehan, thanks for the information. I've been able to replicate this problem in v6.3.0 and agree that it looks like a bug.

becky-gilbert avatar Mar 16 '21 19:03 becky-gilbert

jsPsych uses the fullscreenchange event to handle the fullscreen enter and exit events. According to this stackoverflow answer, the fullscreenchange event is only called when fullscreen mode is triggered by the requestFullscreen API, not when the user 'manually' enters fullscreen mode via the browser's menu or a hotkey (F11). So what's happening is that, when you re-enter fullscreen after exiting, the fullscreenchange events are never triggered, so jsPsych has no way of detecting it.

I guess one way to deal with this is to use the on_interaction_data_update function in jsPsych.init to detect whether the participant has exited fullscreen, and if so, request that they enter fullscreen again using the same requestFullscreen function that's used in the fullscreen plugin. I'm not sure whether it'd be better/easier to do this by adding some JavaScript directly into the on_interaction_data_update function, or to add a new fullscreen-enter trial to the timeline? I think the latter option would require ending the current trial and then immediately running the fullscreen trial.

@juliameehan I'll see if I can make this work, and then post an update on this discussion thread: #1364

I'll leave it up to @jodeleeuw to decide whether we should make any changes to jsPsych. For instance, it might be possible for jsPsych to automatically pause the experiment and run a fullscreen-enter trial when the participant exits fullscreen, but this would have to be parameterized somehow since this may not be something that all researchers want to happen.

becky-gilbert avatar Mar 16 '21 19:03 becky-gilbert

Maybe we can figure out a way for an extension that does this.

I don't think it is a high priority at the moment, but we can take a look after getting through some other updates.

jodeleeuw avatar Mar 16 '21 20:03 jodeleeuw