蒙特屏幕录音机突然无法正常工作。空白视频

发布于 2025-02-13 16:26:37 字数 3208 浏览 2 评论 0原文

我以前使用Montescreenrecorder记录测试执行。一周前,当我的最后一个成功视频被录制时,我没有任何问题。突然,这些视频现在录制了空白。我运行测试...视频已添加到文件夹中,但是当我尝试观看它时,什么也不会发生。它不会加载或启动。只是空白。

这是我的屏幕录音机课:

public class ScreenRecorderUtil extends ScreenRecorder {

 public static ScreenRecorder screenRecorder;
 public String name;
 public ScreenRecorderUtil(GraphicsConfiguration cfg, Rectangle captureArea, Format fileFormat,
   Format screenFormat, Format mouseFormat, Format audioFormat, File movieFolder, String name)
     throws IOException, AWTException {
  super(cfg, captureArea, fileFormat, screenFormat, mouseFormat, audioFormat, movieFolder);
  this.name = name;
 }

 @Override
 protected File createMovieFile(Format fileFormat) throws IOException {

  if (!movieFolder.exists()) {
   movieFolder.mkdirs();
  } else if (!movieFolder.isDirectory()) {
   throw new IOException("\"" + movieFolder + "\" is not a directory.");
  }
  SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH.mm.ss");
  return new File(movieFolder,
    name + "-" + dateFormat.format(new Date()) + "." + Registry.getInstance().getExtension(fileFormat));
 }

 public static void startRecord(String methodName) throws Exception {
  File file = new File("./reports-recordings/");
  Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
  int width = screenSize.width;
  int height = screenSize.height;

  Rectangle captureSize = new Rectangle(0, 0, width, height);

  GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().
    getDefaultScreenDevice()
    .getDefaultConfiguration();
  screenRecorder = new ScreenRecorderUtil(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, methodName);
  screenRecorder.start();
 }

 public static void stopRecord() throws Exception {
  screenRecorder.stop();
 }
}

这是我的基类,我在其中开始和结束记录:

公共抽象类的基础台面扩展了driverutil {

@BeforeMethod
protected static void openDriver() throws Exception {
    DriverUtil.openBrowser();
    ScreenRecorderUtil.startRecord("TestRecording");
}

@AfterMethod
protected static void cleanUp() throws Exception {
    DriverUtil.closeBrowser();
    ScreenRecorderUtil.stopRecord();
}

protected void LOG(String message) {
    TestListener.getTestSection().info(message);
}

protected void IMG(String message) {
    String screenshot = ((TakesScreenshot) UIActions.driver).getScreenshotAs(OutputType.BASE64);
    TestListener.getTestSection().addScreenCaptureFromBase64String(screenshot, message);
}

}

依赖项:

        <dependency>
            <groupId>com.github.stephenc.monte</groupId>
            <artifactId>monte-screen-recorder</artifactId>
            <version>0.7.7.0</version>
        </dependency>

I was previously using the MonteScreenRecorder to record test executions. I had no issues a week ago when my last success video was recorded. Suddenly the videos are recording blank now. I run the test...the video is added to the folder but when I try to watch it nothing happens. It doesn't load or start. It's just blank.

Here's my Screen Recorder Class:

public class ScreenRecorderUtil extends ScreenRecorder {

 public static ScreenRecorder screenRecorder;
 public String name;
 public ScreenRecorderUtil(GraphicsConfiguration cfg, Rectangle captureArea, Format fileFormat,
   Format screenFormat, Format mouseFormat, Format audioFormat, File movieFolder, String name)
     throws IOException, AWTException {
  super(cfg, captureArea, fileFormat, screenFormat, mouseFormat, audioFormat, movieFolder);
  this.name = name;
 }

 @Override
 protected File createMovieFile(Format fileFormat) throws IOException {

  if (!movieFolder.exists()) {
   movieFolder.mkdirs();
  } else if (!movieFolder.isDirectory()) {
   throw new IOException("\"" + movieFolder + "\" is not a directory.");
  }
  SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH.mm.ss");
  return new File(movieFolder,
    name + "-" + dateFormat.format(new Date()) + "." + Registry.getInstance().getExtension(fileFormat));
 }

 public static void startRecord(String methodName) throws Exception {
  File file = new File("./reports-recordings/");
  Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
  int width = screenSize.width;
  int height = screenSize.height;

  Rectangle captureSize = new Rectangle(0, 0, width, height);

  GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().
    getDefaultScreenDevice()
    .getDefaultConfiguration();
  screenRecorder = new ScreenRecorderUtil(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, methodName);
  screenRecorder.start();
 }

 public static void stopRecord() throws Exception {
  screenRecorder.stop();
 }
}

This is my Base Class where I start and end recording:

public abstract class BaseTest extends DriverUtil {

@BeforeMethod
protected static void openDriver() throws Exception {
    DriverUtil.openBrowser();
    ScreenRecorderUtil.startRecord("TestRecording");
}

@AfterMethod
protected static void cleanUp() throws Exception {
    DriverUtil.closeBrowser();
    ScreenRecorderUtil.stopRecord();
}

protected void LOG(String message) {
    TestListener.getTestSection().info(message);
}

protected void IMG(String message) {
    String screenshot = ((TakesScreenshot) UIActions.driver).getScreenshotAs(OutputType.BASE64);
    TestListener.getTestSection().addScreenCaptureFromBase64String(screenshot, message);
}

}

The Dependency:

        <dependency>
            <groupId>com.github.stephenc.monte</groupId>
            <artifactId>monte-screen-recorder</artifactId>
            <version>0.7.7.0</version>
        </dependency>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文