Search in sources :

Example 1 with ScreenRecorder

use of org.monte.screenrecorder.ScreenRecorder in project selenium_java by sergueik.

the class VideoRecorder method startRecording.

public void startRecording(WebDriver driver) {
    try {
        GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
        File dir = new File(RECORD_DIRECTORY);
        Point point = driver.manage().window().getPosition();
        Dimension dimension = driver.manage().window().getSize();
        System.err.println(" Rectangle: " + dimension.width + " " + dimension.height);
        Rectangle rectangle = new Rectangle(point.x, point.y, dimension.width, dimension.height);
        this.screenRecorder = new ScreenRecorder(gc, rectangle, new Format(MediaTypeKey, MediaType.FILE, MimeTypeKey, MIME_AVI), new Format(MediaTypeKey, MediaType.VIDEO, EncodingKey, ENCODING_AVI_TECHSMITH_SCREEN_CAPTURE, CompressorNameKey, ENCODING_AVI_TECHSMITH_SCREEN_CAPTURE, DepthKey, 24, FrameRateKey, Rational.valueOf(15), QualityKey, 1.0f, KeyFrameIntervalKey, 15 * 60), new Format(MediaTypeKey, MediaType.VIDEO, EncodingKey, "black", FrameRateKey, Rational.valueOf(30)), null, dir);
        this.screenRecorder.start();
    } catch (Exception e) {
        System.out.println(e);
    }
}
Also used : SimpleDateFormat(java.text.SimpleDateFormat) Format(org.monte.media.Format) Rectangle(java.awt.Rectangle) ScreenRecorder(org.monte.screenrecorder.ScreenRecorder) Point(org.openqa.selenium.Point) Dimension(org.openqa.selenium.Dimension) File(java.io.File) GraphicsConfiguration(java.awt.GraphicsConfiguration)

Aggregations

GraphicsConfiguration (java.awt.GraphicsConfiguration)1 Rectangle (java.awt.Rectangle)1 File (java.io.File)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Format (org.monte.media.Format)1 ScreenRecorder (org.monte.screenrecorder.ScreenRecorder)1 Dimension (org.openqa.selenium.Dimension)1 Point (org.openqa.selenium.Point)1