Skip to content

A library used to record and edit videos for iOS development

License

Notifications You must be signed in to change notification settings

niyaoyao/NYVideoKit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NYVideoKit

CI Status Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

Pod install

NYVideoKit is available through CocoaPods. To install it, simply add the following line to your Podfile:

source '[email protected]:niyaoyao/NYVideoKitSpec.git'
platform :ios, '8.0' 
target 'project-target-name' do
pod 'NYVideoKit'

end

Access Permission during Runtime

[access] This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSCameraUsageDescription key with a string value explaining to the user how the app uses this data.

Add key-value elements below in Info.plist file to solve the crash issue.

<key>NSCameraUsageDescription</key>
<string>Please allow App to use Camera.</string>
<key>NSMicrophoneUsageDescription</key>
<string>Please allow App to use Microphone.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Please allow App to use Photo Library Assests.</string>

Usage

To use recorder components, you must import the NYVideoKit first.

#import <NYVideoRecorder.h>

@interface ViewController ()

@property (nonatomic, strong) NYVideoRecorder *recorder;

@end


- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    [self.recorder startCapture];
}

- (void)viewDidDisappear:(BOOL)animated {
    [super viewDidDisappear:animated];
    [self.recorder stopCapture];
}

- (NYVideoRecorder *)recorder {
    if (!_recorder) {
        _recorder = [[NYVideoRecorder alloc] init];
        [_recorder setPreviewLayerFrame:self.view.frame];
    }
    return _recorder;
}

- (void)startRecord {
    if(self.recorder.recorderStatus != NYVideoRecorderStatusWriting) {
        [self.recorder startRecording];
        [self.button setTitle:@"⏸️" forState:UIControlStateNormal];
    } else {
        __weak typeof (self) weakSelf = self;
        [self.recorder stopRecording:^(NSError * _Nullable error) {
            if (error) {
                [self showMessage:error.localizedDescription];
            }
            [weakSelf.button setTitle:@"⏺️" forState:UIControlStateNormal];
        }];
    }
}

Author

niyaoyao, [email protected]

License

NYVideoKit is available under the MIT license. See the LICENSE file for more info.

About

A library used to record and edit videos for iOS development

Resources

License

Stars

Watchers

Forks

Packages

No packages published