[UWP]如何在UWP中捕获PC屏幕和录制音频? [英] [UWP]How to capture PC screen and record audio in UWP?

查看:90
本文介绍了[UWP]如何在UWP中捕获PC屏幕和录制音频?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello,

我是开发UWP应用程序的新手。我最近开发了用于屏幕录制的桌面应用程序,它可以捕获屏幕,录制音频。为此,我使用了DirectShowLib中的一些过滤器,
WindowsMediaLib。

现在在  中构建相同的应用程序 UWP,
 我从哪里得到任何线索开始,也没有在UWP中找到有助于我的API。任何人  知道,
帮助我...

Now to build the same application in UWP, I am not getting any clue from where to start and also not finding the API's in UWP that will help me. Anyone knows, please help me...

推荐答案

嗨Raghav,

Hi Raghav,

关于在UWP中捕获屏幕,你可以在这个帖子上提到Rob的回复:
https://stackoverflow.com/questions/35524802/capture-screen-of-the-application-on- a-windows-10-universal-app

About capturing screen in UWP, you could refer Rob’s reply on this thread: https://stackoverflow.com/questions/35524802/capture-screen-of-the-application-on-a-windows-10-universal-app


如果您的应用专门在手机上运行,​​那么它可以使用  ScreenCapture  类
来自电话合同。这在其他设备系列上不可用。


在其他设备上,您可以通过将其渲染到屏幕外位图来捕获应用程序自己的窗口内容(但不能捕获其他内容)。对于Xaml应用程序,请使用  RenderTargetBitmap  类
来渲染页面的根目录。

RenderTargetBitmap renderTargetBitmap = new RenderTargetBitmap(); 
await renderTargetBitmap.RenderAsync(pageRoot, width, height); 



使用GetPixelsAsync提取图像,使用BitmapEncoder编码为位图(jpg,png等),然后保存或共享结果。

如果您想录制音频,请
MediaCapture
相关的API就是你想要的。你可以查看这个
代码示例
了解详情。

If you want to record audio, the MediaCapture relevant APIs would be that you want. You could check this code sample for details.

最好的问候,

Xavier Eoro

Xavier Eoro

注意:这个响应包含对第三方万维网站点的引用。微软提供此信息是为了方便您。微软不控制这些站点,也没有测试在这些站点上找到的任何软件或信息;因此,
Microsoft不能对那里发现的任何软件或信息的质量,安全性或适用性做出任何陈述。使用中存在固有的危险。在互联网上找到的软件,微软提醒您在从互联网上检索任何软件之前确保您完全了解风险。

Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.


这篇关于[UWP]如何在UWP中捕获PC屏幕和录制音频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆