psychojs icon indicating copy to clipboard operation
psychojs copied to clipboard

Skip initial dialog for incorporation of PsychoJS in interactive experiments

Open mgrewe opened this issue 3 years ago • 0 comments

Hi Devs,

we are currently developing an online experiment that combines interactive content from Unity with experiments created by PsychoJS. We are using multiple small PsychoJS experiments for the different parts of the whole experiment, e.g., welcome screen, demographics, questionnaires to collect dependent measures, etc., which should be placed before and after the interactive unity experience. We are still struggling with skipping of the initial dialog where participants have to give their ID for the later PsychoJS parts.

If we just skip scheduling the Dialog, i.e., remove psychoJS.schedule(psychoJS.gui.DlgFromDict(....)); and just directly schedule the flowScheduler with psychoJS.schedule(flowScheduler);, then we get the error

DOMException: Failed to execute 'getImageData' on 'OffscreenCanvasRenderingContext2D': The source width is 0.
    at TextMetrics2.measureFont (http://localhost:8081/psychojs/lib/psychojs-2022.2.3.js:407:2310)
    at TextMetrics2.measureText (http://localhost:8081/psychojs/lib/psychojs-2022.2.3.js:406:65428)
    at TextStim.getTextMetrics (http://localhost:8081/psychojs/lib/psychojs-2022.2.3.js:1303:59536)
    at TextStim._estimateBoundingBox (http://localhost:8081/psychojs/lib/psychojs-2022.2.3.js:1303:61610)
    at new TextStim (http://localhost:8081/psychojs/lib/psychojs-2022.2.3.js:1303:59328)
    at Scheduler.experimentInit [as _currentTask] (http://localhost:8081/psychojs/test.js:143:13)
    at Scheduler._runNextTasks (http://localhost:8081/psychojs/lib/psychojs-2022.2.3.js:1049:33108)
    at async Scheduler._runNextTasks (http://localhost:8081/psychojs/lib/psychojs-2022.2.3.js:1049:33150)
    at async update (http://localhost:8081/psychojs/lib/psychojs-2022.2.3.js:1049:32204)

This is independent of the PsychoJS version (we tried several versions from 2022.1.1 onward). Do you see any chance to change the way the size of the VisualStim is estimated during experiment initialization? That would be awesome. I'm also willing to prepare a pull request but currently stuck with the internal logic of PsychoJS.

Thanks a lot Martin

mgrewe avatar Aug 30 '22 07:08 mgrewe