Media Block
The media
block provides the ability to present the participant a stimulus in the shape of media (audio/image/video). A media
block has to be specified within a stimulus
block. The structure of this block is summarised below.
If the specification of custom controls or replay limits is unnecessary, it is easier to use this block as the available shorthand in the stimulus
block.
Parameters
- image
-
Conditionally required, a
media
block must either specify aimage
, anaudio
or avideo
.
String that specifies the filename of the image file as included in the experiment package that should be displayed. ROLEG currently supports.png
,.gif
, and.jpg
image files.Example:
image = "apple.png"
- audio
- Conditionally required, a
media
block must either specify aimage
, anaudio
or avideo
.
String that specifies the filename of the sound file as included in the experiment package that should be played. ROLEG currently supports.wav
and.mp3
audio files. - video
- Conditionally required, a
media
block must either specify aimage
, anaudio
or avideo
.
String that specifies the filename of the video as included in the experiment package that should be displayed. ROLEG currently supports.mp4
video files.
Info
It is not possible to both have a video stimulus and either an image or audio stimulus. Image and audio stimuli can still be combined, just not with a video stimulus.
- show_controls
- Optional, defaults to
false
.
Boolean that specifies whether controls for an audio or video stimulus are displayed. - max_number_plays
-
Optional, defaults to 1.
Integer that specifies the limit of how many times an audio or video stimulus can be played. The actual amount of media plays will be reflected in the gathered results.show_controls
andmax_number_plays
can not both be present in amedia
block, as with controls no play limit can be enforced. - require_waiting
- Boolean, defaults to
false
.
Boolean that specifies whether the user should wait for the media to finish playing or if they can continue the trial in the meantime, by for example using abutton
response.
Tip
The max_duration
property of an experiment
or stimulus
block can be used to limit a trial or just the stimulus to the duration of the media.
Example usage
The code below illustrates how the media
block might be used.
experiment {
text = "Welcome to the experiment!"
trial {
stimulus {
media {
video = "sample_video.mp4"
max_number_plays = 3
}
}
response {
button
}
}
}