The CSS is entirely cosmetic in this example.
Using await, the following line of code does not get executed until after the promise returned by getDisplayMedia() resolves. getDisplayMedia (displayMediaOptions ) dumpOptionsInfo ( ) } catch (err ) Īfter clearing the contents of the log in order to get rid of any leftover text from the previous attempt to connect, startCapture() calls getDisplayMedia(), passing into it the constraints object defined by displayMediaOptions. In this case, the user agent may include the obscured content, either by getting the current contents of the hidden portion of the window or by presenting the most-recently-visible contents if the current contents are not available. This is done for security reasons, as the content that cannot be seen by the user may contain data which they do not want to share.Ī user agent might allow the capture of the entire content of an obscured window after gaining permission from the user to do so. Generally, the browser will provide an image which obscures the hidden portion of the logical display surface in some way, such as by blurring or replacing with a color or pattern. How these are handled by the Screen Capture API varies. A visible display surface is a surface which is entirely visible on the screen, such as the frontmost window or tab, or the entire screen.Ī logical display surface is one which is in part or completely obscured, either by being overlapped by another object to some extent, or by being entirely hidden or offscreen.
Sharing surfaces include the contents of a browser tab, a complete window, all of the windows of an application combined into a single surface, and a monitor (or group of monitors combined together into one surface). For the purposes of the Screen Capture API, a display surface is any content object that can be selected by the API for sharing purposes.