【发布时间】:2020-12-21 19:54:57
【问题描述】:
我正在使用 MixedReality-WebRTC 制作 UWP 应用。
有没有办法实时获取当前屏幕,而不是网络摄像头?
【问题讨论】:
-
嘿,你知道如何实现你想要的吗?
我正在使用 MixedReality-WebRTC 制作 UWP 应用。
有没有办法实时获取当前屏幕,而不是网络摄像头?
【问题讨论】:
有没有办法实时获取当前屏幕
当然,您可以使用GraphicsCapturePicker 来选择要捕获的窗口,然后使用屏幕捕获 api 获取带有FrameArrived 事件的实时帧。
_framePool.FrameArrived += (s, a) =>
{
// The FrameArrived event fires for every frame on the thread that
// created the Direct3D11CaptureFramePool. This means we don't have to
// do a null-check here, as we know we're the only one
// dequeueing frames in our application.
// NOTE: Disposing the frame retires it and returns
// the buffer to the pool.
using (var frame = _framePool.TryGetNextFrame())
{
// We'll define this method later in the document.
ProcessFrame(frame);
}
};
这里是official document,您可以参考。