Setup in Builder
For displaying video as the video file itself (allowing JavaScript code that interacts with videos, but not PsychoPy VideoStim objects), you will need three components:
*iFrame code component
*HTML code
*Video stimuli, to be called from the HTML code
To set up the iFrame code component, see https://people.beocat.ksu.edu/~karipayne/psychopy/introduction-to-custom-code/03-adding_an_iframe/
You can add in this code component to different routines (not needing to repeat the code in the “Begin Experiment” tab) to display multiple videos through this method. However, you will need to edit and save multiple versions of the index.html file, to call each video. I recommend keeping these all names “index.html” for it to play nice with PsychoPy, but you can place all of these in differently, named folders.
Some important iFrame quirks to note:
- When an iFrame is open, the mouse AND keyboard input is considered to be on the iFrame, and not on the underlying stimulus window. If you want to implement clickable stimuli or button presses for segmentation, you will need to do so in the JS portion of the HTML file (see the next section for specifics).
- This also means that your mouse and keyboard information will not be measured by any PsychoPy Mouse and Keyboard Objects you enter into your routine. You can customize the collected information within the HTML code.
- By default, the iFrame will close when the routine it is in ends. You can use this to set a specific time for the iFrame to remain on the screen. You can also close the iFrame through the index.html code, and that will close the routine it is in.
- You can ONLY pilot the experiment with the iFrame after it is uploaded to Pavlovia.