Video

The video is a GUI element with which multimedia files can be displayed. In addition, the camera of the device can be used as video input. This video can also be recorded. Screenshots are also possible.

The video element can be used as follows:

  1. Adding the element

    final Video video = new Video();
    this.add(video);
  2. Register listener for screenshots

    video.addPictureConsumer(pic -> {
      this.add(pic.toImage("Screenshot"));
    });
  3. Create a screenshot

    video.takePicture();

In addition, videos can be recorded:

video.addVideoConsumer(video -> {
  // ...Video saving logic...
});

// Starts the recording
video.startRecording();

// Stops the recording and calls the VideoConsumer once the video has been sent to the server.
video.stopRecording();

However, videos can also be loaded from a link:

video.addSource(new Source("link/to/video", "video/mp4"));