Search in sources :

Example 1 with Format

use of org.monte.media.Format 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)

Example 2 with Format

use of org.monte.media.Format in project NoraUi by NoraUi.

the class ScreenServiceImpl method startVideoCapture.

/**
 * {@inheritDoc}
 */
@Override
public void startVideoCapture(String screenName) throws IOException, AWTException {
    File file = new File(System.getProperty(USER_DIR) + File.separator + DOWNLOADED_FILES_FOLDER);
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    Rectangle captureSize = new Rectangle(0, 0, screenSize.width, screenSize.height);
    GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
    this.screenRecorder = new NoraUiScreenRecorder(gc, captureSize, 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, file, screenName);
    this.screenRecorder.start();
}
Also used : Format(org.monte.media.Format) Rectangle(java.awt.Rectangle) Dimension(java.awt.Dimension) File(java.io.File) NoraUiScreenRecorder(com.github.noraui.utils.NoraUiScreenRecorder) GraphicsConfiguration(java.awt.GraphicsConfiguration)

Example 3 with Format

use of org.monte.media.Format in project carina by qaprosoft.

the class DesktopVideoRecorder method startDesktopScreenRecording.

/**
 * start Desktop Recording with a lot of parameters.
 * if you have more than one monitor it will record just first one.
 *
 * Requirements:
 * ScreenRecoder supports "AVI" and "QuickTime" format for recording the video.
 * For "AVI" format you need to install TSCC Codec (Techsmith Screen Capture Codec)
 * while "QuickTime" format is supported by Appleā€™s QuickTime Player.
 * https://www.techsmith.com/download.html
 * https://1481d.wpc.azureedge.net/801481D/origin.assets.techsmith.com/Downloads/TSCC.msi
 *
 * @param fileNameBase String
 * @param file File
 * @param captureSize Rectangle
 * @param videoFileFormat can be VideoFormat.AVI or VideoFormat.MOV
 * @param withSound if true will try to record sound. Works only on MOV and with a lot of noises.
 * @throws Exception java.lang.Exception
 */
public void startDesktopScreenRecording(String fileNameBase, File file, Rectangle captureSize, VideoFormat videoFileFormat, boolean withSound) throws Exception {
    GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
    Format audio = null;
    // AVI format
    if (videoFileFormat.equals(VideoFormat.AVI)) {
        if (withSound) {
        // Not working AVI audio capabilities. Investigate if will be needed.
        /*
                 * audio = new Format(MediaTypeKey, MediaType.AUDIO,
                 * EncodingKey, ENCODING_AVI_PCM,
                 * ByteOrderKey,ByteOrder.LITTLE_ENDIAN,
                 * SignedKey,true,SampleSizeInBitsKey,24);
                 */
        /*
                 * audio = new Format(MediaTypeKey,MediaType.AUDIO,EncodingKey,ENCODING_PCM_UNSIGNED,
                 * FrameRateKey, new Rational(48000L, 1L),
                 * SampleSizeInBitsKey, 16,
                 * ChannelsKey, 2,
                 * SignedKey,false);
                 */
        /*
                 * audio = new Format(MediaTypeKey, MediaType.AUDIO,
                 * EncodingKey, ENCODING_PCM_UNSIGNED,
                 * FrameRateKey, new Rational(48000L, 1L),
                 * SampleSizeInBitsKey,8,
                 * ChannelsKey, 2,
                 * SampleRateKey, new Rational(48000L, 1L),
                 * SignedKey, Boolean.valueOf(false)
                 * //,
                 * //AudioFormatKeys.ByteOrderKey, ByteOrder.BIG_ENDIAN
                 * );
                 */
        }
        this.screenRecorder = new SpecializedScreenRecorder(gc, captureSize, 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)), audio, file, fileNameBase);
    }
    // MOV format
    if (videoFileFormat.equals(VideoFormat.MOV)) {
        if (withSound) {
            audio = new Format(MediaTypeKey, MediaType.AUDIO, EncodingKey, ENCODING_QUICKTIME_TWOS_PCM, FrameRateKey, new Rational(48000L, 1L), SampleSizeInBitsKey, 16, ChannelsKey, 2, SampleRateKey, new Rational(48000L, 1L), SignedKey, Boolean.valueOf(true), AudioFormatKeys.ByteOrderKey, ByteOrder.BIG_ENDIAN);
        }
        this.screenRecorder = new SpecializedScreenRecorder(gc, captureSize, new Format(MediaTypeKey, MediaType.FILE, FormatKeys.MimeTypeKey, MIME_QUICKTIME), new Format(MediaTypeKey, MediaType.VIDEO, EncodingKey, ENCODING_QUICKTIME_ANIMATION, CompressorNameKey, COMPRESSOR_NAME_QUICKTIME_ANIMATION, DepthKey, 24, FrameRateKey, Rational.valueOf(15)), new Format(MediaTypeKey, MediaType.VIDEO, EncodingKey, "black", FrameRateKey, Rational.valueOf(30)), audio, file, fileNameBase);
    }
    LOGGER.info("Start video recording. \nAbsolute path: " + file.getAbsolutePath() + " . \nStarting name is '" + fileNameBase + "'. \nDimensions: " + captureSize.toString());
    this.screenRecorder.start();
}
Also used : Format(org.monte.media.Format) Rational(org.monte.media.math.Rational)

Example 4 with Format

use of org.monte.media.Format in project acceptance-test-harness by jenkinsci.

the class TestRecorderRule method startRecording.

private void startRecording(Description des) {
    try {
        GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
        String mimeType = FormatKeys.MIME_QUICKTIME;
        String videoFormatName = VideoFormatKeys.ENCODING_QUICKTIME_ANIMATION;
        String compressorName = VideoFormatKeys.COMPRESSOR_NAME_QUICKTIME_ANIMATION;
        Dimension outputDimension = gc.getBounds().getSize();
        int bitDepth = BIT_DEPTH;
        float quality = QUALITY_RATIO;
        int screenRate = FRAME_RATE_PER_SEC;
        Format outputFormatForScreenCapture = getOutputFormatForScreenCapture(videoFormatName, compressorName, outputDimension, bitDepth, quality, screenRate);
        this.screenRecorder = new JUnitScreenRecorder(gc, gc.getBounds(), getFileFormat(mimeType), outputFormatForScreenCapture, null, null, diagnostics);
        this.screenRecorder.start();
    } catch (HeadlessException e) {
        logger.warning("Test recorder does not work with Headless mode");
        this.headless = true;
    } catch (UnsupportedOperationException | IOException | AWTException e) {
        logger.log(Level.WARNING, "Exception starting test recording", e);
    }
}
Also used : Format(org.monte.media.Format) HeadlessException(java.awt.HeadlessException) Dimension(java.awt.Dimension) IOException(java.io.IOException) GraphicsConfiguration(java.awt.GraphicsConfiguration) AWTException(java.awt.AWTException)

Aggregations

Format (org.monte.media.Format)4 GraphicsConfiguration (java.awt.GraphicsConfiguration)3 Dimension (java.awt.Dimension)2 Rectangle (java.awt.Rectangle)2 File (java.io.File)2 NoraUiScreenRecorder (com.github.noraui.utils.NoraUiScreenRecorder)1 AWTException (java.awt.AWTException)1 HeadlessException (java.awt.HeadlessException)1 IOException (java.io.IOException)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Rational (org.monte.media.math.Rational)1 ScreenRecorder (org.monte.screenrecorder.ScreenRecorder)1 Dimension (org.openqa.selenium.Dimension)1 Point (org.openqa.selenium.Point)1