sweetbean.stimulus.Video
Video
Bases: _KeyboardResponseStimulus
shows a video
Source code in sweetbean/stimulus/Video.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | |
__init__(duration=None, stimulus=None, choices=None, correct_key='', trial_ends_after_video=True, autoplay=True, controls=False, width=None, height=None, muted=True, side_effects=None)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
duration
|
Optional[int]
|
time in ms the stimulus is presented (alias for trial_duration) |
None
|
stimulus
|
Optional[Union[str, List[str]]]
|
video source(s). Either a single string or a list of strings (URLs/paths). You can specify multiple formats of the same video (e.g., .mp4, .ogg, .webm) to maximize the cross-browser compatibility. |
None
|
choices
|
keys to accept (e.g., ["f","j"]), or "ALL" / "NO_KEYS" |
None
|
|
correct_key
|
str
|
the correct key to press (optional) |
''
|
trial_ends_after_video
|
bool
|
end the trial automatically when video finishes |
True
|
autoplay
|
bool
|
start playback automatically |
True
|
controls
|
bool
|
show native video controls |
False
|
width, height
|
optional pixel dimensions |
required | |
muted
|
bool
|
mute audio (often required for autoplay) |
True
|
side_effects
|
Optional side-effect configuration passed to the runtime. This expects a list of SideEffect definitions (see SweetBean docs) which can be used to update global data like overall score or trial counter. |
None
|
Source code in sweetbean/stimulus/Video.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | |