Skip to main content

@rtorcato/browser-common / screencapture

screencapture

Functions​

isScreenCaptureAvailable()​

isScreenCaptureAvailable(): boolean

Defined in: screencapture/index.ts:10

Checks if the Screen Capture API (getDisplayMedia) is available.

Example​

import { isScreenCaptureAvailable } from '@rtorcato/browser-common/screencapture'
if (isScreenCaptureAvailable()) showShareButton()

Returns​

boolean

True if available, false otherwise.


getDisplayMedia()​

getDisplayMedia(options?): Promise<MediaStream>

Defined in: screencapture/index.ts:29

Prompts the user to share a screen, window, or tab and returns the stream.

Example​

import { getDisplayMedia } from '@rtorcato/browser-common/screencapture'
const stream = await getDisplayMedia({ video: true })

Parameters​

options?​

DisplayMediaStreamOptions

Optional display-media constraints.

Returns​

Promise<MediaStream>

A promise resolving to the captured MediaStream.

Throws​

If called where Screen Capture is unsupported.