@@ -131,6 +131,12 @@ const info = <const>{
131
131
pretty_name : "Response allowed while playing" ,
132
132
default : true ,
133
133
} ,
134
+ hide_slider_while_video_plays : {
135
+ type : ParameterType . BOOL ,
136
+ pretty_name : "Hide slider while video plays" ,
137
+ default : false ,
138
+ description : "If true the slider will be hidden while the video plays and it will appear when the video stops"
139
+ } ,
134
140
} ,
135
141
} ;
136
142
@@ -274,6 +280,10 @@ class VideoSliderResponsePlugin implements JsPsychPlugin<Info> {
274
280
if ( trial . trial_ends_after_video ) {
275
281
end_trial ( ) ;
276
282
} else if ( ! trial . response_allowed_while_playing ) {
283
+ if ( trial . hide_slider_while_video_plays ) {
284
+ show_slider ( ) ;
285
+ }
286
+
277
287
enable_slider ( ) ;
278
288
}
279
289
} ;
@@ -310,6 +320,10 @@ class VideoSliderResponsePlugin implements JsPsychPlugin<Info> {
310
320
var currenttime = video_element . currentTime ;
311
321
if ( currenttime >= trial . stop ) {
312
322
video_element . pause ( ) ;
323
+ if ( trial . hide_slider_while_video_plays ) {
324
+ show_slider ( ) ;
325
+ }
326
+
313
327
if ( trial . trial_ends_after_video && ! stopped ) {
314
328
// this is to prevent end_trial from being called twice, because the timeupdate event
315
329
// can fire in quick succession
@@ -336,6 +350,11 @@ class VideoSliderResponsePlugin implements JsPsychPlugin<Info> {
336
350
. addEventListener ( "touchstart" , enable_button ) ;
337
351
}
338
352
353
+ if ( trial . hide_slider_while_video_plays ) {
354
+ hide_slider ( ) ;
355
+ }
356
+
357
+
339
358
var startTime = performance . now ( ) ;
340
359
341
360
// store response
@@ -405,6 +424,14 @@ class VideoSliderResponsePlugin implements JsPsychPlugin<Info> {
405
424
}
406
425
}
407
426
427
+ function hide_slider ( ) {
428
+ ( document . getElementsByClassName ( "jspsych-video-slider-response-container" ) [ 0 ] as HTMLElement ) . style . display = "none" ;
429
+ }
430
+
431
+ function show_slider ( ) {
432
+ ( document . getElementsByClassName ( "jspsych-video-slider-response-container" ) [ 0 ] as HTMLElement ) . style . display = "" ;
433
+ }
434
+
408
435
// end trial if time limit is set
409
436
if ( trial . trial_duration !== null ) {
410
437
this . jsPsych . pluginAPI . setTimeout ( end_trial , trial . trial_duration ) ;
0 commit comments