如何使用 LWUIt VIdeoComponent 捕获图像

发布于 2024-12-09 05:31:01 字数 176 浏览 0 评论 0原文

我尝试过使用 MediaComponent,但由于它现在已被弃用,因此不会有很好的进展。另外,我无法在表单上将其大小调整为全屏。我正在尝试使用 VideoComponent 在 S40 设备中捕获屏幕截图。我无法找到如何正确实例化 VideoComponent 来捕获图像而不播放视频。

I have tried using MediaComponent, but since it is now deprecated it wont be good moving forward. Also i was not able to get it to re-size to full screen on the form. I am trying to use VideoComponent to capture a screen shot in an S40 device. I cant find how to instantiate the VideoComponent properly for capturing an image and not playing a video.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

弄潮 2024-12-16 05:31:01

您可以使用 VideoComponent 来捕获图像。

首先,要实例化 VideoComponent,您需要创建一个本机对等体:

VideoComponent videoComponent = VideoComponent.createVideoPeer("capture://video");
Player player = (Player) videoComponent.getNativePeer();
player.realize();
VideoControl videoControl = (VideoControl) player.getControl("VideoControl");

要捕获图像,您必须启动视频组件并使用 Video Control 的 getSnapshot:

videoComponent.start();
videoControl.getSnapshot(null);

如果您想将视频组件调整为全屏,您可以使用:

videoComponent.setFullScreen(false);

其他可能性是:

videoComponent.setPreferredH(Display.getInstance().getDisplayHeight());
videoComponent.setPreferredW(Display.getInstance().getDisplayWidth());

You can use VideoComponent for capturing an image.

First, to instantiate the VideoComponent, you need to create a native peer:

VideoComponent videoComponent = VideoComponent.createVideoPeer("capture://video");
Player player = (Player) videoComponent.getNativePeer();
player.realize();
VideoControl videoControl = (VideoControl) player.getControl("VideoControl");

To capture the image, you have to start video component and use getSnapshot of Video Control:

videoComponent.start();
videoControl.getSnapshot(null);

If you want to resize the video component to full screen you can use:

videoComponent.setFullScreen(false);

Other posibility is:

videoComponent.setPreferredH(Display.getInstance().getDisplayHeight());
videoComponent.setPreferredW(Display.getInstance().getDisplayWidth());
岁月打碎记忆 2024-12-16 05:31:01

目前,VideoComponent 主要是为播放而设计的,对于捕获来说效果不佳。我们将在不久的将来尝试改进它,使其更加灵活。从 MediaComponent 迁移到 VideoComponent 相对容易,因此应该不成问题。

Right now the VideoComponent is mostly designed for playback and doesn't really work well for capture. We will try to improve it in the near future to make it more flexible. Its relatively easy to migrate from MediaComponent to VideoComponent so it shouldn't be a problem.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文