microsoft / Windows.UI.Composition-Win32-Samples

Windows.UI.Composition Win32 Samples
MIT License
469 stars 186 forks source link

Capture without GraphicsCapturePicker in UWP app #53

Closed artths closed 1 year ago

artths commented 4 years ago

Can we use this API in UWP app without calling GraphicsCapturePicker? What if I want create desktop streaming application, so that the client could connect to host and begin streaming whole screen without the need of calling GraphicsCapturePicker on the host? I see there is CreateForMonitor function in Win32 version of screen capture.

Tar4s commented 4 years ago

@artsemionov you could find the answer here https://github.com/robmikh/Win32CaptureSample

artths commented 4 years ago

But it's for using API for Win32, I need UWP

leonardoblanco-ms commented 4 years ago

Window and monitor capture without the picker is not yet available for UWP applications, but it is under construction for a future release. We hope to bring it to the community soon.

unboundin commented 1 year ago

@leonardoblanco-ms - Is monitor capture without picker now available for UWP applications? Is there a fully working sample and documentation available somewhere? Thank you

robmikh commented 1 year ago

You'll want to use GraphicsCaptureItem.TryCreateFromDisplayId. But don't forget to first request access using GraphicsCaptureAccess.RequestAccess. You also need to specify the graphicsCaptureProgrammatic capability in your manifest. Keep in mind these APIs are available to consumers in Windows 11, and will not run on most Windows 10 builds.

There's a sample you can look at here: https://github.com/robmikh/uwpcapturesample

robmikh commented 1 year ago

Closing the issue since these APIs are now documented. If you run into any issues, let us know!