|
|||||||||||||||||
Issue descriptionAllow 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. Mar 10 2013, Project Member
Apr 6 2013, Project Member
Jun 22 2016, Project Member
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 Jun 24 2016,
Is this still being proposed? Jul 13 2016,
Let's close this for now and re-open when there's appetite. Jul 13 2016,
Jul 13 2016,
Oct 18 2016,
Nov 23 2016,
Jan 26 2017,
Assigned to yours truly. Feb 22 2017,
Sep 18 2017,
Jan 9 2018,
Jan 10, Project Member
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 Jan 10,
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 Jan 10,(getDisplayMedia is tracked in Issue 326740 ) 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! Jan 10,
> - 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. Jan 11,applyConstraints() could be used on the track to adjust resolution. |
|||||||||||||||||
►
Sign in to add a comment |
Comment 1 by scheib@chromium.org, Mar 22 2012