PennController.CheckPreloadedGlobal Commands

PennController.CheckPreloaded()

or PennController.CheckPreloaded( labels )

or PennController.CheckPreloaded( delay )

or PennController.CheckPreloaded( labels , delay )

By default, PennController starts the preloading of every image, audio and video resource used in your experiment as soon as the experiment starts running and it will wait before running a trial that all the resources it uses are preloaded. Since this could result in undesirable random breaks in the flow of your experiment, you can control when PennController should check that the resources used by (subsets of) your trials are preloaded before proceeding by using PennController.CheckPreloaded.

Note that PennController.CheckPreloaded inserts a trial in your experiment the same way PennController does. You can label the generated trial by using the label command so you can refer to it within PennController.Sequence.

You can also define a delay after which the trial sequence will proceed anyway if preloading fails, by passing a number as the last parameter of the command (in milliseconds). Each resource that PennController fails to preload will be reported in a new line in the results file.

Example:

PennController.CheckPreloaded("audio", "video");

PennController( "audio" ,
    newAudio("audio file", "test.mp3")
        .print()
        .play()
        .wait()
);

PennController( "video" ,
    newVideo("video file", "skate.mp4")
        .print()
        .play()
        .wait()
);

PennController.CheckPreloaded();

PennController( "filler" ,
    newImage("image", "square.png")
        .print()
    ,
    newKey("fj", "FJ")
        .wait()
);

PennController( "test" ,
    newImage("image", "triangle.png")
        .print()
    ,
    newKey("fj", "FJ")
        .wait()
);

Will make sure that test.mp3 and skate.mp4 are fully preloaded before running the very first PennController trial, labeled audio. After the PennController trial labeled video has ended, will make sure that all image, audio and video resources ever used in the experiment are preloaded before running the trial labeled filler (which practically means it will check that square.png and triangle.png are preloaded, since the first preloader made sure the audio and video resources were already preloaded).