New issue
Advanced search Search tips
Starred by 19 users

Issue metadata

Status: WontFix
Owner: ----
Closed: Jan 10
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Feature

Blocked on:
issue 487935
issue webrtc:1757
issue 326740
issue 518807
issue 669257



Sign in to add a comment
link

Issue 118551: Screenshot API

Reported by scheib@chromium.org, Mar 16 2012 Project Member

Issue description

Allow JavaScript to request a screen shot of page contents, probably allow limiting to a particular element's bounding box.

Would be used for application feedback tools. E.g. Google Feedback tool.

Also useful for other applications desiring a flattened composited image of page contents from mixed sources such as HTML, WebGL, etc.

Clearly this has security and privacy concerns, and appropriate user interface would be required to allow that privilege escalation.
 

Comment 2 by bugdroid1@chromium.org, Mar 10 2013

Project Member
Labels: -Area-WebKit Cr-Content

Comment 3 by bugdroid1@chromium.org, Apr 6 2013

Project Member
Labels: -Cr-Content Cr-Blink

Comment 4 by sheriffbot@chromium.org, Jun 22 2016

Project Member
Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been available for more than 365 days, and should be re-evaluated. Hotlist-Recharge-Cold label is added for tracking. Please re-triage this issue.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Comment 5 by pdr@chromium.org, Jun 24 2016

Owner: scheib@chromium.org
Status: Assigned (was: Untriaged)
Is this still being proposed?

Comment 6 by dglazkov@chromium.org, Jul 13 2016

Status: Archived (was: Assigned)
Let's close this for now and re-open when there's appetite.

Comment 7 by mcasas@chromium.org, Jul 13 2016

Cc: mcasas@chromium.org
Components: -Blink Blink>GetUserMedia>Desktop Blink>MediaStream>ImageCapture
Labels: OS-All

Comment 8 by scheib@chromium.org, Jul 13 2016

Status: Available (was: Archived)

Comment 9 by mcasas@chromium.org, Oct 18 2016

Blockedon: 518807

Comment 10 by sshru...@google.com, Nov 23 2016

Components: -Blink>MediaStream>ImageCapture Blink>ImageCapture

Comment 11 by mcasas@chromium.org, Jan 26 2017

Cc: scheib@chromium.org
Owner: mcasas@chromium.org
Status: Assigned (was: Available)
Assigned to yours truly.

Comment 12 by mcasas@chromium.org, Feb 22 2017

Comment 13 by mcasas@chromium.org, Sep 18 2017

Owner: ----
Status: Available (was: Assigned)

Comment 14 by scheib@chromium.org, Jan 9 2018

Cc: -scheib@chromium.org

Comment 15 by sheriffbot@chromium.org, Jan 10

Project Member
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Comment 16 by mcasas@chromium.org, Jan 10

Status: WontFix (was: Untriaged)
With the navigator.getDisplayMedia() [1] API landing in 72, 
screenshot functionality can be polyfilled with something like:

navigator.mediaDevices.getDisplayMedia(constraints)
      .then(handleSuccess)
      .catch(handleError);

function handleSuccess(mediaStream) {
  let videoTrack = mediastream.getVideoTracks()[0];

  let imageCapturer = new ImageCapture(videoTrack);

  imageCapturer.takePhoto()
    .then((blob) => {
      console.log("Screenshot taken: " + blob.type + ", " + blob.size + "B")
      imageTag.src = URL.createObjectURL(blob);
    })
    .catch((err) => { 
      console.error("takePhoto() failed: ", e);
    });
}

(where |imageTag| is just an <img> element, see the demo where
this comes from in [2]).

[1] https://cdn.rawgit.com/uysalere/js-demos/master/gdm2.html
[2] https://codepen.io/miguelao/pen/BLPzKx?editors=1010#0

Comment 17 by mcasas@chromium.org, Jan 10

(getDisplayMedia is tracked in  Issue 326740 )

Comment 18 by mfo...@chromium.org, Jan 10

Cool.  I had a few questions that weren't answered by the code snippet above or a quick look at the ImageCapturer spec.

- How can the caller request a frame grab with he same dimensions as the source (whether desktop or tab viewport)?

- What image format is returned in the blob?

- How would the page be able to crop out a specific element's bounding box?  Presumably by cropping the takePhoto() result in <canvas>?

- Will Chrome's permissions prompt make sense if the user is clicking on a link that says "Take Screenshot"?

Thanks!

Comment 19 by mcasas@chromium.org, Jan 10

Cc: emir...@chromium.org guidou@chromium.org
> - How can the caller request a frame grab with he same dimensions as the source (whether desktop or tab viewport)?

By default the MediaStream(Video)Track generated by 
navigator.mediaDevices.getDisplayMedia() has the same dimensions as the
captured content (be that screen, app window or tab); +emircan@ to keep
me real here.

> - What image format is returned in the blob?

|blob.type| will be the encoded image format, in general image/png
(if we do it in software) or image/jpeg (if it's hardware provided)
(see e.g. the console for the demo https://codepen.io/miguelao/full/BLPzKx)

> - How would the page be able to crop out a specific element's bounding box?  Presumably by cropping the takePhoto() result in <canvas>?

That, or: setting new constraints on the MediaStream(Video)Track 
to make that adapt the resolution. This might be in-flight, so
+guidou@ to provide more info if relevant

- Will Chrome's permissions prompt make sense if the user is clicking on a link that says "Take Screenshot"?

..ish? The current window speaks about "share your screen" :-/
Not perfect, I wonder if there could be a way to pre-seed the text
of the selection window and/or limit the available choices (e.g. 
to the current App or its Tabs, but not the whole screen?) +emircan@
again.
Screenshot from 2019-01-10 17-03-37.png
166 KB View Download

Comment 20 by guidou@chromium.org, Jan 11

applyConstraints() could be used on the track to adjust resolution.

Sign in to add a comment