jeudi 10 juin 2021

calling object from a randomized array

hello I need a little help with trying to call a video to play from an array that has been randomized.

I created an array that holds my stimulus information

var cs01 = {
 
video: ['cs01-event-n04-bounce.mp4' , 'cs01-process-n04-float.mp4', 'cs01-process-n04-walk.mp4', 'cs02-event-n04-jump.mp4'],
sentence: ["the seahorse bounced"],
animal: ["seahorse"],
type: ["event"] };

I then want to randomize my array to randomize the order of my stimulus video so that when I call my array the videos are presented in random order

var randomvideo = jsPsych.randomization.factorial(cs01, 1) 
  console.log(randomvideo)

however it's not quiet working as expected. Im not sure if its the way I have the randomization function set up or if im not calling my videos correctly in the var vid but my videos are not being played after the instruction block, the array is logged into my console but my videos aren't playing

for (j in randomvideo) {
var vid = 'videos/' + randomvideo['video']
var video_trial = {
    type: "video-keyboard-response",
    choices: [],
    sources: [vid],
    width: 1000,
    height: 600,
    trial_ends_after_video: true,
    data: {subject:subj,
    experiment: 'vv1-constant-nopause',
    stimulus: vid,
    testpart:'video'

  }
}

anything helps thank you in advanced!




Aucun commentaire:

Enregistrer un commentaire