Code Monkey home page Code Monkey logo

capture-kit's Introduction

capture-kit: a framework written in Objective-C that provides functions that can be used to capture the contents of a screen

capture-kit

CodeCov CodeCov CodeCov CI CodeCov

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

  1. Create a new instance of NVCaptureService that encompasses screen capturing functionality.
NVCaptureService *captureService = [[NVCaptureService alloc] init];
  1. Set a delegate to receive recording-related events:
captureService.delegate = self;
  1. 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.
NVAudioService *audioService = [[NVAudioService alloc] initWithMediaDeviceProvider:[NVMediaDeviceProvider new]];
NSArray<NSString *> *ids = [audioService audioDevicesIDs];

You can also check whether an audio device is connected to the system like this:

BOOL isConnected = [audioService isAudioDeviceConnected:@"<device_id_here>"];
  1. Start screen capture
NSRect sampleRect = CGRectMake(0, 0, 1200, 1800);
NSURL *sampleURL = [[NSURL alloc] initWithString:@"file_url"];

[_captureService startRecordingWithAudioDeviceID:@"<device_id_here>"
                                            rect:sampleRect
                                 directDisplayID:kCGDirectMainDisplay
                                   outputFileURL:sampleURL];

Also, you can pass a custom capture configuration using objc - (void)startRecordingWithConfiguration:deviceID:rect:directDisplayID:outputFileURL:

  1. For pausing, resuming, and cancelling, you can use the following methods:
- (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, [email protected]

License

capture-kit is available under the MIT license. See the LICENSE file for more info.

capture-kit's People

Contributors

nik3212 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.