URL of experiment: https://gitlab.pavlovia.org/MBClab/sifi
Description of the problem:
I am designing an experiment where either audio, visual, or audio-visual stimuli must be played. This works fine on firefox, but the audio doesn’t play consistently in chrome. That is, the sound should play for one frame and then stop, and the code is executing in chrome (there is no error message, either), but the sound isn’t heard. This only happens on some of the sound trials; on occasion the sound plays as it should. Here is some of the relevant code:
if (frameN >= start && soundFlash1.status === PsychoJS.Status.NOT_STARTED){
// keep track of start time/frame for later
soundFlash1.tStart = t; // (not accounting for frame time here)
soundFlash1.frameNStart = frameN; // exact frame index
psychoJS.window.callOnFlip(function(){ soundFlash1.play(); }); // screen flip
soundFlash1.status = PsychoJS.Status.STARTED;
}
if ((soundFlash1.status === PsychoJS.Status.STARTED || soundFlash1.status === PsychoJS.Status.FINISHED) &&
(frameN >= soundFlash1.frameNStart + 1)){
if (soundFlash1.status != PsychoJS.Status.FINISHED){
soundFlash1.tEnd = t;
soundFlash1.frameNEnd = frameN;
finalStim = frameN;
}
soundFlash1.stop();
soundFlash1.status = PsychoJS.Status.FINISHED;
}
I am using a .mp3 audiofile for this. Thank you in advance!