Windows api screenshot
With screen capture, developers invoke secure system UI for end users to pick the display or application window to be captured, and a yellow notification border is drawn by the system around the actively captured item. In the case of multiple simultaneous capture sessions, a yellow border is drawn around each item being captured.
This article describes capturing a single image of the display or application window. For information on encoding frames captured from the screen to a video file, see Screen capture to video.
The APIs found in the Windows. Capture namespace require a general capability to be declared in your application's manifest:. Before launching the system UI, you can check to see if your application is currently able to take screen captures. There are several reasons why your application might not be able to use screen capture, including if the device does not meet hardware requirements or if the application targeted for capture blocks screen capture.
Once you've verified that screen capture is supported, use the GraphicsCapturePicker class to invoke the system picker UI. The end user uses this UI to select the display or application window of which to take screen captures.
Because this is UI code, it needs to be called on the UI thread. If you're calling it from the code-behind for a page of your application like MainPage.
To avoid pixel overclipping i. This article will focus on SDR content capturing. Once the user has explicitly given consent to capturing an application window or display in the system UI, the GraphicsCaptureItem can be associated to multiple CaptureSession objects.
This way your application can choose to capture the same item for various experiences. To capture multiple items at the same time, your application must create a capture session for each item to be captured, which requires invoking the picker UI for each item that is to be captured. With your frame pool and capture session created, call the StartCapture method on your GraphicsCaptureSession instance to notify the system to start sending capture frames to your app:.
FrameArrived event:. See Properties of shared screen tracks for details about additional constraints for configuring a screen-capture stream that are added to MediaTrackConstraints , MediaTrackSupportedConstraints , and MediaTrackSettings.
None of the constraints are applied in any way until after the content to capture has been selected. The contraints alter what you see in the resulting stream. For example, if you specify a width constraint for the video, it's applied by scaling the video after the user selects the area to share. It doesn't establish a restriction on the size of the source itself. This ensures that web applications can't force the user to share specific content by restricting the source list until only one item is left.
While display capture is in effect, the machine which is sharing screen contents will display some form of indicator so the user is aware that sharing is taking place. Note: For privacy and security reasons, screen sharing sources are not enumerable using enumerateDevices. Related to this, the devicechange event is never sent when there are changes to the sources available for getDisplayMedia.
However, user agents may allow the capture of audio along with the video content. The source of this audio might be the selected window, the entire computer's audio system, or the user's microphone or a combination of all of the above. Before starting a project that will require sharing of audio, be sure to check the Browser compatibility in MediaDevices.
To request that the screen be shared with included audio, the options passed into getDisplayMedia might look like this:. This allows the user total freedom to select whatever they want, within the limits of what the user agent supports. This could be refined further by specifying additional information for each of audio and video :. In this example the cursor will always be visible in the capture, and the audio track should ideally have noise suppression and echo cancellation features enabled, as well as an ideal audio sample rate of Capturing audio is always optional, and even when web content requests a stream with both audio and video, the returned MediaStream may still have only one video track, with no audio.
Note: Some properties are not widely implemented and might not be used by the engine. The promise returned by getDisplayMedia resolves to a MediaStream that contains at least one video stream that contains the screen or screen area, and which is adjusted or filtered based upon the constraints specified when getDisplayMedia was called.
As is always the case when sharing content over a network, it's important to consider the privacy and safety implications of screen sharing. Privacy and security issues surrounding screen sharing are usually not overly serious, but they do exist.
The largest potential issue is users inadvertently sharing content they did not wish to share. Read the original article on Business Insider. Microsoft and partners may be compensated if you purchase something through recommended links in this article. Found the story interesting? Like us on Facebook to see similar stories. I'm already a fan, don't show this again.
Send MSN Feedback. How can we improve? Please give an overall site rating:. Privacy Statement. Opens in a new window Opens an external site Opens an external site in a new window.
0コメント