A simple and stable camera component in iOS, which can help quickly build your own audio and video module.
To run the example project, clone the repo, and run pod install
from the Example directory first.
XDCaptureService is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'XDCaptureService'
@property (nonatomic, strong) XDCaptureService *service;
self.service = [[XDCaptureService alloc] init];
_service.delegate = self;
[_service startRunning];
@protocol XDCaptureServiceDelegate <NSObject>
@optional
//service lifecylce
- (void)captureServiceDidStartService:(XDCaptureService *)service;
- (void)captureService:(XDCaptureService *)service serviceDidFailWithError:(NSError *)error;
- (void)captureServiceDidStopService:(XDCaptureService *)service;
- (void)captureService:(XDCaptureService *)service getPreviewLayer:(AVCaptureVideoPreviewLayer *)previewLayer;
- (void)captureService:(XDCaptureService *)service outputSampleBuffer:(CMSampleBufferRef)sampleBuffer;
//record module
- (void)captureServiceRecorderDidStart:(XDCaptureService *)service ;
- (void)captureService:(XDCaptureService *)service recorderDidFailWithError:(NSError *)error;
- (void)captureServiceRecorderDidStop:(XDCaptureService *)service;
//photo capture
- (void)captureService:(XDCaptureService *)service capturePhoto:(UIImage *)photo;
//face detect
- (void)captureService:(XDCaptureService *)service outputFaceDetectData:(NSArray <AVMetadataFaceObject*>*) faces;
//depth map
- (void)captureService:(XDCaptureService *)service captureTrueDepth:(AVDepthData *)depthData API_AVAILABLE(ios(11.0));
@end
Capture a photo, record a video, face detect, capture depth map data, switch camera, focus, whiteBalance,ISO and so on.
You can view more usage details in the demo project.
XDCaptureService is available under the MIT license. See the LICENSE file for more info.