Skip to content

Commit

Permalink
Rename the displayId option to screenId
Browse files Browse the repository at this point in the history
And make it a number instead of a string.
  • Loading branch information
sindresorhus committed Jul 2, 2018
1 parent 3ae0a45 commit 38f8222
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitattributes
@@ -0,0 +1 @@
* text=auto eol=lf
2 changes: 1 addition & 1 deletion .travis.yml
@@ -1,5 +1,5 @@
os: osx
osx_image: xcode9.3
osx_image: xcode9.4
language: node_js
node_js:
- 'node'
4 changes: 2 additions & 2 deletions index.js
Expand Up @@ -36,7 +36,7 @@ class Aperture {
cropArea = undefined,
showCursor = true,
highlightClicks = false,
displayId = 'main',
screenId = 0,
audioDeviceId = undefined,
videoCodec = undefined
} = {}) {
Expand Down Expand Up @@ -67,7 +67,7 @@ class Aperture {
fps,
showCursor,
highlightClicks,
displayId,
screenId,
audioDeviceId
};

Expand Down
8 changes: 4 additions & 4 deletions readme.md
Expand Up @@ -128,12 +128,12 @@ Highlight cursor clicks in the screen recording.

Enabling this will also enable the `showCursor` option.

##### displayId
##### screenId

Type: `string`<br>
Default: `main`
Type: `number`<br>
Default: `aperture.screens()[0]` *(Primary screen)*

Display to record.
Screen to record.

##### audioDeviceId

Expand Down
13 changes: 11 additions & 2 deletions swift/aperture/Recorder.swift
Expand Up @@ -27,11 +27,20 @@ final class Recorder: NSObject {
}

/// TODO: When targeting macOS 10.13, make the `videoCodec` option the type `AVVideoCodecType`
init(destination: URL, fps: Int, cropRect: CGRect?, showCursor: Bool, highlightClicks: Bool, displayId: CGDirectDisplayID = .main, audioDevice: AVCaptureDevice? = .default(for: .audio), videoCodec: String? = nil) throws {
init(
destination: URL,
fps: Int,
cropRect: CGRect?,
showCursor: Bool,
highlightClicks: Bool,
screenId: CGDirectDisplayID = .main,
audioDevice: AVCaptureDevice? = .default(for: .audio),
videoCodec: String? = nil
) throws {
self.destination = destination
session = AVCaptureSession()

let input = AVCaptureScreenInput(displayID: displayId)
let input = AVCaptureScreenInput(displayID: screenId)

/// TODO: Use `CMTime(seconds:)` here instead
input.minFrameDuration = CMTime(value: 1, timescale: Int32(fps))
Expand Down
4 changes: 2 additions & 2 deletions swift/aperture/main.swift
Expand Up @@ -16,7 +16,7 @@ struct Options: Decodable {
let cropRect: CGRect?
let showCursor: Bool
let highlightClicks: Bool
let displayId: String
let screenId: CGDirectDisplayID
let audioDeviceId: String?
let videoCodec: String?
}
Expand All @@ -31,7 +31,7 @@ func record() throws {
cropRect: options.cropRect,
showCursor: options.showCursor,
highlightClicks: options.highlightClicks,
displayId: options.displayId == "main" ? CGMainDisplayID() : CGDirectDisplayID(options.displayId)!,
screenId: options.screenId == 0 ? .main : options.screenId,
audioDevice: options.audioDeviceId != nil ? AVCaptureDevice(uniqueID: options.audioDeviceId!) : nil,
videoCodec: options.videoCodec
)
Expand Down

0 comments on commit 38f8222

Please sign in to comment.