-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Linux Support (again) #32
Conversation
|
Also note my comment in #7: #7 (comment) |
index.js
Outdated
if (process.platform === 'darwin') { | ||
return execa.stdout(path.join(__dirname, 'swift/main'), ['list-audio-devices']).then(JSON.parse); | ||
} else if (process.platform === 'linux') { | ||
return execa.stdout('sh', ['-c', "arecord -l | awk 'match(\$0, /card ([0-9]): ([^,]+),/, result) { print result[1] \":\" result[2] }'"]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use JS for as much as possible. No awk.
package.json
Outdated
"build": "cd swift && xcodebuild -derivedDataPath $(mktemp -d) -scheme aperture", | ||
"prepublish": "npm run build" | ||
"build-macos": "cd swift && xcodebuild -derivedDataPath $(mktemp -d) -scheme aperture", | ||
"postinstall": "[ \"$(uname)\" = \"Darwin\" ] && npm run build-macos", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one should be removed.
index.js
Outdated
@@ -9,11 +9,17 @@ const debuglog = util.debuglog('aperture'); | |||
|
|||
class Aperture { | |||
constructor() { | |||
macosVersion.assertGreaterThanOrEqualTo('10.10'); | |||
if (process.platform === 'darwin') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create top level constants IS_MACOS and IS_LINUX to simplify all these if else statements.
You can do that by putting the following in module.exports().startRecording().then(console.log).catch(console.error); |
I'm sure it works for me. I just have zero macs on which to confirm the functionality. I addressed the code review concerns and added the mouse cursor toggle. |
Not sure what changed between last night and today, but I was getting |
@sindresorhus Anything else? |
args.push('-i', ':0'); | ||
} | ||
|
||
args.push('-framerate', fps, '-draw_mouse', +(showCursor === true), this.tmpPath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
String(showCursor === true)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you verify this works? Based on the documentation, draw_mouse
expects a binary value. That's why I'm coercing the boolean to an int.
Setting By default it captures only part of the screen, while it should capture the whole screen. Setting the
It also needs to be in the format:
ffmpeg version 3.0.7-0ubuntu0.16.10.1 |
Confirmed.
I'll look into it.
Cannot reproduce locally.
From your sample output, is that
Same here. |
if (IS_MACOS) { | ||
return execa.stdout(path.join(__dirname, 'swift/main'), ['list-audio-devices']).then(JSON.parse); | ||
} else if (IS_LINUX) { | ||
return execa.stdout('arecord', ['-l']).then( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-l
=> --list-devices
|
It seems if you specify |
This is the fixes (and some) of the PR #7. I couldn't figure out how to continue progress on that branch/PR.
Let me know if everything still works.
Question: Why don't we/you use
ffmpeg
on all platforms? It seems like it would greatly simplify the code and it would add support for MacOS older than 10.10.