News for hackers. Stuff that matters.
Re:Show HN: Screen recording with JavaScript by dshankar on Thursday May 22, 2014 @04:35AM (#7782754)
Please do not do this.

You should not instruct users to change flags in order to use this. This opens up fairly serious security loopholes as malicious websites can start screensharing without being instantiated by the user.

Instead of using the getUserMedia API directly, you should use Chrome's chooseDesktopMedia API to get a desktop capture source (the screen, a tab, or any application window). The chooseDesktopMedia API is available in Chrome 34+ and can be used to do desktop screen capture/share without asking the user to enable flags.

As of 6 hours ago, the flag (#enable-usermedia-screen-capture) has been removed and will not be present in Chrome 35 Stable. [Ref: https://codereview.chromium.org/270353002 & https://code.google.com/p/chromium/issues/detail?id=347641]

In any case, cool hack!

Re:Show HN: Screen recording with JavaScript by dshankar on Thursday May 22, 2014 @04:41AM (#7782768)
Another benefit of using cDM: more visitors to your site would be able to use your app right now instead of posting "Chrome vers. doesn't work" :-)

20% of the world (and likely an even larger percentage of HN users) already have cDM support! [http://caniuse.com/usage_table.php]

Re:Show HN: Screen recording with JavaScript by gk1 on Thursday May 22, 2014 @08:21AM (#7783418)
I was excited about this at first. I don't know of any simple way to record my screen without having to download decade-old software. A web-based solution like this would be amazing... Until I realized I'd have to follow a list of work-arounds just to get it working.

Hoping this is just the first trial run and the next iteration will get this resolved.

Re:Show HN: Screen recording with JavaScript by dshankar on Thursday May 22, 2014 @04:55PM (#7786463)
The getUserMedia API is still fairly early. If the OP used the chooseDesktopMedia API in concert with getUserMedia and built a Chrome Extension, you wouldn't have to do any of these work-arounds.

I expect an enormous number of Chrome Extensions that do all sorts of web-based screen recording & sharing in the coming months.

Re:Show HN: Screen recording with JavaScript by randall on Thursday May 22, 2014 @10:16AM (#7783951)
(yo Darshan!)

Correct me if I'm wrong but isn't that api an extension only api?

https://developer.chrome.com/extensions/desktopCapture

Re:Show HN: Screen recording with JavaScript by cpncrunch on Thursday May 22, 2014 @02:22PM (#7785374)
It does look like it is only for extensions. Does this mean it will now be impossible for users to use desktop sharing from web apps?

I don't really see the security problem. Right now there is a popup asking if you want to share your screen, and there is also a permanent warning at the bottom of the screen while the screen is being shared. Also it is only available on https sites. What possible security risk is there?

Re:Show HN: Screen recording with JavaScript by dshankar on Thursday May 22, 2014 @04:53PM (#7786450)
In M34, a user can still use getUserMedia with a screen media source as long as they enable the flag.

In M35+, the flag will no longer appear. Thus, the only way to get a screen media source (tab, screen, window etc.) in the first place is to use the chooseDesktopMedia API. That will give you a source id to use with the getUserMedia API.

Re:Show HN: Screen recording with JavaScript by dshankar on Thursday May 22, 2014 @04:50PM (#7786431)
(Hey Randall! :-)

Yes, it requires an extension and that's the way it ought to be. Explicit user-intent, properly sandboxed.

Allowing any website to arbitrarily capture your entire desktop screen (or any application screen) is an enormous security risk that shouldn't be taken lightly, so an extension seems like the right decision.

Re:Show HN: Screen recording with JavaScript by cpncrunch on Thursday May 22, 2014 @05:16PM (#7786605)
Here's the issue...our product is an html5 cross-platform web conferencing platform. Users simply click on a link to join a session. Our product isn't an extension - it's simply html and javascript.

So basically you're saying that we either need to change the architecture of our app for Chrome so that it is an extension, or else put the screen-sharing part into an extension. (I'm guessing our entire app would need to be an extension, due to 'sandboxing', although I'm not certain). To be honest I'm not sure why we should change to an extension just for chrome (and just to get screen sharing). It's a bit like telling us we need to rewrite our app in NaCl just for chrome :)

Ideally I would like a cross-platform screen sharing feature in getUserMedia, similar to how it worked in Chrome (but without the user having to set any flags).

I don't really buy the arguments in http://tools.ietf.org/html/draft-ietf-rtcweb-security-06#sec.... Worst case is a dumb user gives permission to screen share to a dodgy site which then reads their bank balance and/or emails (but can't get access to any passwords). If that's a concern then why not just have a small preview window showing exactly what is being shared?

Re:Show HN: Screen recording with JavaScript by dshankar on Thursday May 22, 2014 @09:44PM (#7787621)
Hi! I think you missed the security implications of the current getUserMedia model for screen access.

While you wish to have the easiest user experience (no extension, one click screen share/capture), this is a dangerous problem.

Let me explain... when a user currently enables the #enable-usermedia-screen-capture flag in Chrome, this allows any JavaScript on any webpage to capture a chromeDesktopSource such as a window or tab without being initiated or approved by the user.

Imagine a malicious website or advertisement that now calls getUserMedia and takes a screencap of your personal email account, bank account or private chat. The user may or may not notice the Chrome notice saying "http://website is sharing your screen" (paraphrased) but even if the user noticed it and pressed "Stop" the damage has already been done. It only takes a fraction of a second for a malicious app to screencap each browser tab.

By Chrome 35, you will no longer have to set any flags, but you will not be able to get the chromeDesktopSource without first going through the chooseDesktopMedia API.

Each time a website wants access to a Desktop Source (screen, tab, or window), it will have to explicitly ask the user for a source and permission via the Chrome dialog.

Does that make more sense now? Hope it helps.

Re:Show HN: Screen recording with JavaScript by dshankar on Thursday May 22, 2014 @09:47PM (#7787627)
One more clarification: this is for chromeDesktopSource - I do not believe you'll have to use chooseDesktopMedia or create an extension to get access to the webcam video or audio stream. This is just about desktop media (screen, tab or app window) access.
Re:Show HN: Screen recording with JavaScript by cpncrunch on Thursday May 22, 2014 @11:08PM (#7787787)
I can't find any reference to chromeDesktopSource anywhere - is that correct?

Currently there is a prompt every time when you request the desktop chromeMediaSource: 'screen' - it says something like 'Allow this web page to share your screen'. It definitely does not just grab your screen automatically with no prior warning.

According to the WebRtc bug report the ONLY way you will now be able to access the desktop is via an extension. Chrome are doing this because they believe there are too many risks in desktop sharing, and even putting a bigger, scarier warning isn't sufficient because many users apparently ignore warnings.

Re:Show HN: Screen recording with JavaScript by thrush on Thursday May 22, 2014 @10:58AM (#7784161)
Even with security risk, this is a bit of a golden egg for automated selenium testing!
Re:Show HN: Screen recording with JavaScript by MasterScrat on Thursday May 22, 2014 @04:38AM (#7782764)
It would be really nice to be able to record a portion of my browser window, convert the sequence to a GIF and upload it to imgur.

That would make some bug reports much clearer, rather than describing each step.

Re:Show HN: Screen recording with JavaScript by scraplab on Thursday May 22, 2014 @06:15AM (#7783042)
Yes, this would be brilliant. I'd really like it as an always available app with a hotkey to activate recording, and Dropbox integration for upload + sharing. Even limited to a few seconds it'd be very useful for developing complex UI interactions with a remote team.
Re:Show HN: Screen recording with JavaScript by MattBearman on Thursday May 22, 2014 @10:47AM (#7784111)
Shameless plug: My app BugMuncher (http://bugmuncher.com) allows you to submit screenshots with bug reports, without needing any browser plugins or experimental APIs. The ability to take a sequence of screenshots for each bug report is on the road map.
Re:Show HN: Screen recording with JavaScript by gk1 on Thursday May 22, 2014 @08:23AM (#7783423)
> ...convert the sequence to a GIF and upload it to imgur.

I would even pay for a tool like this.

Re:Show HN: Screen recording with JavaScript by Jonovono on Thursday May 22, 2014 @11:17AM (#7784261)
I am working on a project to do that for the Mac: https://github.com/Jonovono/cutter. I originally wanted to do it in JS for the web but didn't find away. May revisit that now!
Re:Show HN: Screen recording with JavaScript by xhrpost on Thursday May 22, 2014 @09:33AM (#7783726)
Trying to think how you could build this. Unless there's some fancy new feature in the browsers, I think you'd have to do something complicated like run WebKit.JS and capture from the canvas output.
Re:Show HN: Screen recording with JavaScript by petercooper on Thursday May 22, 2014 @10:14AM (#7783941)
It's not browser based but such a thing exists for Windows and OS X: http://www.cockos.com/licecap/
Re:Show HN: Screen recording with JavaScript by SimeVidas on Thursday May 22, 2014 @08:39AM (#7783491)
Why is Firefox not supported? https://github.com/mgechev/jscapture/issues/5
Re:Show HN: Screen recording with JavaScript by gcp on Thursday May 22, 2014 @09:02AM (#7783582)
FWIW Firefox for Android supports sharing Tabs via getUserMedia.
Re:Show HN: Screen recording with JavaScript by yaronn01 on Friday May 23, 2014 @06:39AM (#7788732)
I recently did something similar with official javascript APIs:

http://s3-us-west-2.amazonaws.com/anigif100/pacman/index.htm...

Re:Show HN: Screen recording with JavaScript by wingerlang on Thursday May 22, 2014 @02:47AM (#7782465)
Chrome Version 35.0.1916.114 OSX 10.9

I get an error then a blank modal. On both buttons. Nothing in the console to tell me more or anything like that.

Re:Show HN: Screen recording with JavaScript by sync on Thursday May 22, 2014 @02:49AM (#7782474)
From the readme:

    Currently the API for screen capturing is supported only by Google Chrome, Canary and Chromium by enabling an experimental flag.

    In order to enable the flag:

    Go to chrome://flags
    Enable - "Enable screen capture support in getUserMedia()"
    Restart your browser
https://github.com/mgechev/jscapture#how-to-use
Re:Show HN: Screen recording with JavaScript by ioseph on Thursday May 22, 2014 @02:49AM (#7782471)
Chrome 34.0.1847.137m on Win7, getting an alert: "Error, while recording your screen"
Re:Show HN: Screen recording with JavaScript by eskimobloood on Thursday May 22, 2014 @03:04AM (#7782512)
Seems the app is a test to verify that people don't read the README.
Re:Show HN: Screen recording with JavaScript by hsx on Thursday May 22, 2014 @08:19AM (#7783408)
This is cool but video should scale to screensize. Yes, I do understand that this is more of a proof of concept.
Re:Show HN: Screen recording with JavaScript by frozenport on Thursday May 22, 2014 @08:45AM (#7783515)
"With great power comes great responsibility"