Skip to content

Commit

Permalink
Update api
Browse files Browse the repository at this point in the history
  • Loading branch information
karaggeorge committed Nov 21, 2024
1 parent aa19366 commit 5a90466
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"location" : "https://github.com/wulkano/Aperture",
"state" : {
"branch" : "george/rewrite-in-screen-capture-kit",
"revision" : "ac1febd90238b0bbd1989beac2d7db3a4ca20f41"
"revision" : "d89d3e4b827b1e284388788976be79e3ee3cb798"
}
},
{
Expand Down
12 changes: 6 additions & 6 deletions Sources/ApertureNode/ApertureNode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import AVFoundation

@NodeActor
@NodeMethod
func startRecording(_ targetString: NodeString, _ options: NodeObject) async throws {
func start(_ targetString: NodeString, _ options: NodeObject) async throws {
let target: Aperture.Target

switch try targetString.string() {
Expand All @@ -34,13 +34,13 @@ import AVFoundation
throw try NodeError(code: nil, message: "Invalid value provided for target. screen, window, audioOnly or externalDevice expected.")
}

try await self.recorder.startRecording(target: target, options: options.asOptions())
try await self.recorder.start(target: target, options: options.asOptions())
}

@NodeActor
@NodeMethod
func stopRecording() async throws {
try await self.recorder.stopRecording()
func stop() async throws {
try await self.recorder.stop()
}

@NodeActor
Expand Down Expand Up @@ -280,8 +280,8 @@ extension Aperture.Devices.Window: @retroactive NodeValueConvertible {
"id": String(self.id),
"title": self.title,
"frame": self.frame.nodeValue(),
"applicationName": self.applicationName,
"applicationBundleIdentifier": self.applicationBundleIdentifier,
"appName": self.appName,
"appBundleIdentifier": self.appBundleIdentifier,
"isActive": self.isActive,
"isOnScreen": self.isOnScreen,
"layer": self.layer
Expand Down
4 changes: 2 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ export type Screen = {
export type Window = {
id: string;
title?: string;
applicationName?: string;
applicationBundleIdentifier?: string;
appName?: string;
appBundleIdentifier?: string;
isActive: boolean;
isOnScreen: boolean;
layer: number;
Expand Down
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class Recorder {
losslessAudio,
systemAudio,
}) {
return this._startRecording('audio', {
return this._startRecording('audioOnly', {
audioDeviceId,
losslessAudio,
systemAudio,
Expand Down Expand Up @@ -95,7 +95,7 @@ export class Recorder {
finalOptions.microphoneDeviceID = recorderOptions.audioDeviceId;
}

await this.recorder.startRecording(targetType === 'audio' ? 'audioOnly' : targetType, finalOptions);
await this.recorder.start(targetType, finalOptions);
}

throwIfNotStarted() {
Expand All @@ -121,7 +121,7 @@ export class Recorder {

async stopRecording() {
this.throwIfNotStarted();
await this.recorder.stopRecording();
await this.recorder.stop();

delete this.recorder;
delete this.isFileReady;
Expand Down
4 changes: 2 additions & 2 deletions utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export function normalizeOptions(targetType, {
recordSystemAudio: systemAudio,
};

if (videoCodec && targetType !== 'audio') {
if (videoCodec && targetType !== 'audioOnly') {
const codecMap = new Map([
['h264', ['mp4', 'mov', 'm4v']],
['hevc', ['mp4', 'mov', 'm4v']],
Expand All @@ -81,7 +81,7 @@ export function normalizeOptions(targetType, {
}

const temporaryPath = temporaryFile({
extension: targetType === 'audio' ? 'm4a' : extension,
extension: targetType === 'audioOnly' ? 'm4a' : extension,
});

recorderOptions.destination = fileUrl(temporaryPath);
Expand Down

0 comments on commit 5a90466

Please sign in to comment.