Code Monkey home page Code Monkey logo

capture-all-screens's Introduction

Capture all screens explainer

Introduction

getAllScreensMedia is an API that allows clients to capture all monitors attached to a device at once without user interaction. It is only available in managed sessions for allow-listed web apps and it is a requirement that the user must be informed about capturing at all times. The usage indicator cannot be prevented by the web app.

Motivation

Web developers have expressed interest for such an API in order to meet legal and internal compliance requirements.

Use cases

  • Contact centers may require full documentation of provided information for compliance and / or training purposes.
  • In the financial industry a consultant may provide financial advice digitally and a complete documentation of the information may be required by law in some jurisdictions.
  • Internet usage in prisons may require full traceability to allow convicts to access the internet.

API

getAllScreensMedia can be used similarly to getDisplayMedia with a few differences:

  • getAllScreensMedia returns a promise to a sequence of MediaStreams (one MediaStream per monitor).
  • Constraints cannot be passed in the getAllScreensMedia call. Constraints may be different depending on the monitor and information determining the desired constraints (resolution, size, โ€ฆ) is likely only available after the monitor was captured. Constraints can be applied on the returned MediaStreamTrack with applyConstraints.
  • getAllScreensMedia will only be available for web apps allowlisted by a policy.
  • Usage indicators must be shown to the user at all times.

getAllScreensMedia will use ScreenCaptureMediaStreamTrack (which is a subclass of MediaStreamTrack) in the returned MediaStream which provides access to monitor details analogous to the getScreenDetails API.

partial interface MediaDevices {
 Promise<sequence<MediaStream>> getAllScreensMedia();
}
interface ScreenCaptureMediaStreamTrack : MediaStreamTrack {
  ScreenDetailed screenDetailed();
}

Example usage

try {
  const mediaStreams = await navigator.mediaDevices.getAllScreensMedia();
  mediaStreams.forEach((mediaStream, index) => {
    files.push(saveToFile(mediaStream));
  })
} catch (e) {
  console.log('Unable to acquire screen captures: ' + e);
}

Alternatives considered

One alternative is to first pursue getDisplayMediaSet (mediacapture-screen-share/issues/204), which allows the user to choose multiple surfaces, then add a managed-only setting on top which would auto-accept all monitors. This approach was abandoned due to insufficient Web-developer interest in the former without the latter.

capture-all-screens's People

Contributors

eladalon1983 avatar marcoscaceres avatar shangl avatar yoavweiss avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.