https://github.com/space-code/capture-kit
CaptureKit is a framework written in Objective-C that provides functions that can be used to capture the contents of a screen.
https://github.com/space-code/capture-kit
avfoundation capture-screen capture-video objective-c
Last synced: about 1 month ago
JSON representation
CaptureKit is a framework written in Objective-C that provides functions that can be used to capture the contents of a screen.
- Host: GitHub
- URL: https://github.com/space-code/capture-kit
- Owner: space-code
- License: mit
- Created: 2023-10-06T06:43:45.000Z (over 2 years ago)
- Default Branch: dev
- Last Pushed: 2023-10-20T04:31:06.000Z (over 2 years ago)
- Last Synced: 2025-02-21T01:03:20.939Z (12 months ago)
- Topics: avfoundation, capture-screen, capture-video, objective-c
- Language: Objective-C
- Homepage:
- Size: 904 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README

capture-kit
## Description
`capture-kit` is a framework written in Objective-C that provides functions that can be used to capture the contents of a screen.
- [Usage](#usage)
- [Requirements](#requirements)
- [Communication](#communication)
- [Contributing](#contributing)
- [Author](#author)
- [License](#license)
## Usage
1. Create a new instance of `NVCaptureService` that encompasses screen capturing functionality.
```objc
NVCaptureService *captureService = [[NVCaptureService alloc] init];
```
2. Set a delegate to receive recording-related events:
```objc
captureService.delegate = self;
```
3. An optional step: If you want to capture microphone sound, you need to obtain a microphone ID. To do this, create a new instance of `NVAudioService` that provides a list of connected device IDs.
```objc
NVAudioService *audioService = [[NVAudioService alloc] initWithMediaDeviceProvider:[NVMediaDeviceProvider new]];
NSArray *ids = [audioService audioDevicesIDs];
```
You can also check whether an audio device is connected to the system like this:
```objc
BOOL isConnected = [audioService isAudioDeviceConnected:@""];
```
4. Start screen capture
```objc
NSRect sampleRect = CGRectMake(0, 0, 1200, 1800);
NSURL *sampleURL = [[NSURL alloc] initWithString:@"file_url"];
[_captureService startRecordingWithAudioDeviceID:@""
rect:sampleRect
directDisplayID:kCGDirectMainDisplay
outputFileURL:sampleURL];
```
Also, you can pass a custom capture configuration using ```objc - (void)startRecordingWithConfiguration:deviceID:rect:directDisplayID:outputFileURL:```
5. For pausing, resuming, and cancelling, you can use the following methods:
```objc
- (void)pause
- (void)resume
- (void)stop
```
## Requirements
- macOS 11.0+
- Xcode 14.0
## Communication
- If you **found a bug**, open an issue.
- If you **have a feature request**, open an issue.
- If you **want to contribute**, submit a pull request.
## Contributing
Bootstrapping development environment
```
make bootstrap
```
Please feel free to help out with this project! If you see something that could be made better or want a new feature, open up an issue or send a Pull Request!
## Author
Nikita Vasilev, nv3212@gmail.com
## License
capture-kit is available under the MIT license. See the LICENSE file for more info.