Skip to content

Commit

Permalink
⬆️ desktop-capturer.
Browse files Browse the repository at this point in the history
  • Loading branch information
hokein committed May 21, 2016
1 parent 0ffc12a commit fc40831
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 18 deletions.
14 changes: 7 additions & 7 deletions desktop-capture/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
// limitations under the License.
// Author: Dongseong Hwang ([email protected])

var desktopCapturer = require('desktop-capturer');
const {desktopCapturer} = require('electron');

var desktopSharing = false;
var localStream = null;
let desktopSharing = false;
let localStream;

function refresh() {
$('select').imagepicker({
Expand All @@ -28,15 +28,15 @@ function addSource(source) {
value: source.id.replace(":", ""),
text: source.name
}));
$('select option[value="' + source.id.replace(":", "") + '"]').attr('data-img-src', source.thumbnail.toDataUrl());
$('select option[value="' + source.id.replace(":", "") + '"]').attr('data-img-src', source.thumbnail.toDataURL());
refresh();
}

function showSources() {
desktopCapturer.getSources({ types:['window', 'screen'] }, function(error, sources) {
for (var i = 0; i < sources.length; ++i) {
console.log("Name: " + sources[i].name);
addSource(sources[i]);
for (let source of sources) {
console.log("Name: " + source.name);
addSource(source);
}
});
}
Expand Down
11 changes: 5 additions & 6 deletions desktop-capture/main.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
var app = require('app');
var BrowserWindow = require('browser-window');
const {app, BrowserWindow} = require('electron');

var mainWindow = null;
let mainWindow;

app.on('window-all-closed', function() {
app.on('window-all-closed', () => {
if (process.platform != 'darwin')
app.quit();
});

app.setPath("userData", __dirname + "/saved_recordings");

app.on('ready', function() {
app.on('ready', () => {
mainWindow = new BrowserWindow({width: 800, height: 600});

mainWindow.loadURL('file://' + __dirname + '/index.html');

mainWindow.on('closed', function() {
mainWindow.on('closed', () => {
mainWindow = null;
});
});
2 changes: 1 addition & 1 deletion desktop-capture/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name" : "desktop-capture-demo",
"version" : "0.1.0",
"version" : "1.1.0",
"main" : "main.js"
}
4 changes: 0 additions & 4 deletions desktop-capture/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ A sample app allows you to choose which screen or window to be captured with

[desktopCapturer](https://github.com/atom/electron/blob/master/docs/api/desktop-capturer.md)

## Required minimum version

v0.36.0

## Screenshot

![screenshot](https://cloud.githubusercontent.com/assets/2557445/10268326/993e4f9a-6ae7-11e5-8fd1-a24b9800b9ce.gif)

0 comments on commit fc40831

Please sign in to comment.