trial_video_slider_response: Specify a video trial with slider bar response

Description Usage Arguments Details Value See Also

View source: R/trial_video_slider_response.R

Description

The trial_video_slider_response function is used to play a video stimulus and collect a response using a slider bar.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
trial_video_slider_response(
  sources,
  trial_ends_after_video = FALSE,
  width = NULL,
  height = NULL,
  autoplay = TRUE,
  controls = FALSE,
  start = NULL,
  stop = NULL,
  rate = 1,
  labels = c("0%", "25%", "50%", "75%", "100%"),
  min = 0,
  max = 100,
  slider_start = 50,
  step = 1,
  slider_width = NULL,
  require_movement = FALSE,
  button_label = "Continue",
  prompt = NULL,
  trial_duration = NULL,
  response_ends_trial = TRUE,
  post_trial_gap = 0,
  on_finish = NULL,
  on_load = NULL,
  data = NULL
)

Arguments

sources

Path(s) to the video file. Videos may be specified in multiple formats (e.g., .mp4, .ogg, .webm)

trial_ends_after_video

If TRUE the trial will end as soon as the video finishes playing.

width

The width of the video display in pixels (if NULL, natural width is used)

height

The height of the video display in pixels (if NULL, natural height is used)

autoplay

Does the video play automatically?

controls

Should the video controls be shown?

start

Time point in seconds to start video (NULL starts at the beginning)

stop

Time point in seconds to stop video (NULL stops at the end)

rate

What rate to play the video (1 = normal, <1 slower, >1 faster)

labels

Labels displayed at equidistant locations on the slider.

min

Minimum value of the slider

max

Maximum value of the slider

slider_start

Initial value of the slider

step

Step size of the slider

slider_width

Horizontal width of the slider (defaults to display width)

require_movement

Does the user need to move the slider before clicking the continue button?

button_label

Label placed on the "continue" button

prompt

A string (may contain HTML) that will be displayed below the stimulus, intended as a reminder about the actions to take (e.g., which key to press).

trial_duration

How long to wait for a response before ending trial in milliseconds. If NULL, the trial will wait indefinitely. If no response is made before the deadline is reached, the response will be recorded as NULL.

response_ends_trial

If TRUE, then the trial will end when a response is made (or the trial_duration expires). If FALSE, the trial continues until the deadline expires.

post_trial_gap

The gap in milliseconds between the current trial and the next trial. If NULL, there will be no gap.

on_finish

A javascript callback function to execute when the trial finishes

on_load

A javascript callback function to execute when the trial begins, before any loading has occurred

data

An object containing additional data to store for the trial

Details

The trial_video_slider_response function belongs to the "stimulus-response" family of trials, all of which display a stimulus of a particular type (image, audio, video or HTML) and collect responses using a particular mechanism (button, keyboard or slider). This one plays a video and records responses generated with a slider.

Stmulus display

TBA

Response mechanism

Participant responses for this trial type are collected using a slider bar that the participant can move using the mouse. Once the participant is happy with this positioning they can click a button at the bottom of the page to move on to the next trial. This response method can be customised in several ways depending on the following arguments:

Other behaviour

As is the case for most trial_ functions there is a prompt argument, a string that specifies additional text that is displayed on screen during the trial. The value of prompt can contain HTML markup, allowing it to be used quite flexibly if needed.

Depending on parameter settings, the trial can end when the subject responds (response_ends_trial = TRUE), or after a fixed amount of time (specified using the trial_duration argument) has elapsed. The trial can also be made to end automatically at the end of the video using the trial_ends_after_video argument.

Like all functions in the trial_ family it contains four additional arguments:

Data

When this function is called from R it returns the trial object that will later be inserted into the experiment when build_experiment is called. However, when the trial runs as part of the experiment it returns values that are recorded in the jsPsych data store and eventually form part of the data set for the experiment.

The data recorded by this trial is as follows:

In addition, it records default variables that are recorded by all trials:

Value

Functions with a trial_ prefix always return a "trial" object. A trial object is simply a list containing the input arguments, with NULL elements removed. Logical values in the input (TRUE and FALSE) are transformed to character vectors "true" and "false" and are specified to be objects of class "json", ensuring that they will be written to file as the javascript logicals, true and false.

See Also

Within the "stimulus-response" family of trials, there are four types of stimuli (image, audio, video and HTML) and three types of response options (button, keyboard, slider). The corresponding functions are trial_image_button_response, trial_image_keyboard_response, trial_image_slider_response, trial_audio_button_response, trial_audio_keyboard_response, trial_audio_slider_response, trial_video_button_response, trial_video_keyboard_response, trial_video_slider_response, trial_html_button_response, trial_html_keyboard_response and trial_html_slider_response.


djnavarro/jaysire documentation built on April 12, 2021, 4:25 a.m.