Video
element
description
Creates a media player that supports video playback.
syntax
newVideo(ELEMENT_NAME: string, URL: string)
-
ELEMENT_NAME
: The name of the newly-created element. -
URL
: The URL of the video file.
since
beta 0.4example(s)
@newVideo("myVideo", "http://myserver/video.mp4")
+ Creates a Action commands
video.disable
syntax
.disable()
description
Will disable the controls interface. Note that some browsers might make the controls disappear altogether.
example
click to expand
@newVideo("skate.mp4")
@ .print()
$ .disable(0.01)
@ .play()
@ .wait()
- Prints a disabled interface for the video test.mp3 and starts playing it. The video will be fully visible because the layer is transparent (0.01 opacity).
video.log
syntax
.log()
description
Tells to add a line in the results file each time an event happens. If you do not specify which event you want to log, all of them will add a line to the results file.
example
click to expand
@
@newText("instructions", "Please watch the video below")
@ .print()
@,
@newVideo("scene", "test_scene.mp4")
@ .once()
$ .log()
@ .print()
@ .wait()
@,
@newButton("validation", "Validate")
@ .print()
@ .wait()
-
Adds some instruction text to the screen and control buttons below the text. After the video gets played, the control buttons are grayed out, and a Validate button appears below them.
-
The results file will contain as many lines for when the video was played, paused, when it ended playing and when its position was changed by clicking the progress bar.
video.once
syntax
.once()
description
Disables the buttons to play/pause the video right after its first playing (the video can still be played using the action play
).
example
click to expand
@
@newText("instructions", "Please watch the video below")
@ .print()
@,
@newVideo("skate", "skate.mp4")
$ .once()
@ .print()
@ .wait()
- Adds some instruction text to the screen and a video below the text. After the video has played, the interface is grayed out and playback is no longer accessible.
video.pause
syntax
.pause()
description
Pauses the video file.
example
click to expand
@
@newVideo("sentence", "skate.mp4")
@ .print()
@ .play()
@,
@newTimer("preview", 2500)
@ .start()
@ .wait()
@,
@getVideo("sentence")
$ .pause()
- Starts playing the file skate.mp4 and pauses it after 2500ms.
video.play
syntax
.play()
description
Starts playing the video file.
example
click to expand
@newVideo("beep", "skate.mp4")
@ .print()
@ .play()
- Starts playing the file skate.mp4.
video.print
syntax
.print()
description
Adds the <video>
element to the screen.
example
click to expand
@newVideo("skate", "skate.mp4")
@ .print()
- Show an interface to play the video file skate.mp4 onto the screen.
video.remove
syntax
.remove()
description
Removes the <video>
element from the screen.
example
click to expand
@
@newVideo("skate", "skate.mp4")
@ .print()
@ .wait()
@,
@getVideo("skate")
$ .remove()
- Adds the video ksate.mp4 onto the screen, and removes it from the screen after the video has been fully played.
video.stop
syntax
.stop()
description
Stops the playback of the video and goes back to the start of it, making it impossible to resume from the current position later.
example
click to expand
@newVideo("skate", "skate.mp4")
@ .print()
@ .play()
@,
@newTimer("preview", 2500)
@ .start()
@ .wait()
@,
@getVideo("skate")
@ .stop()
- Prints and starts playing the file sentence.mp4 and stops it after 2500ms. It will not be possible to resume playback from there by simply calling
play
later on.
video.wait
syntax
.wait()
description
Waits until the video resource is done playing before evaluating and executing the next commands.
example
click to expand
@newVideo("skate", "skate.mp4")
@ .print()
@ .play()
@,
@newButton("validation", "Validate")
@ .print()
@ .wait()
@,
@getVideo("skate")
$ .wait("first")
@,
@newText("thanks", "Thank you for watching")
@ .print()
-
Starts playing the file skate.mp4 and adds a button onto the screen. If the button is clicked before the video is done playing for the first time, it waits until the end before printing the text Thank you for watching. If the button is clicked after the video has been fully played once, the text appears even while in the middle of a replay.
Test commands
video.test.hasPlayed
syntax
.test.hasPlayed()
description
Tests whether the video stream has played at least once before in the trial.
example
click to expand
@newVideo("myVideo", "file.mp4")
@ .print()
@,
@newButton("Next")
@ .print()
@ .wait(
$ getVideo("myVideo").test.hasPlayed()
$ .failure( newText("Please play the video first").print() )
@ )
- After the button Next is pressed and the printed video isn’t played yet, the program will throw error saying that the video should be played first.
video.test.playing
syntax
.test.playing()
description
Tests whether the video stream is playing at the moment when the test command gets evaluated.
example
click to expand
@newVideo("myVideo", "file.mp4")
@ .print()
@,
@newButton("Next")
@ .print()
@ .wait(
$ getVideo("myVideo").test.playing()
$ .failure( newText("Please let the video finish first").print() )
@ )
- After the button Next is pressed and the printed video is still playing, the program will throw error saying that the video should be finished first.