iOSMp4Cameravideo,mp4,camera,視訊,錄製,拍攝錄製視訊,並且將視訊轉換成mp4格式
阿新 • • 發佈:2019-02-04
[vision startPreview];
}
//給螢幕新增支援長按拍攝功能
- (void)_handleLongPressGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer
{
switch (gestureRecognizer.state) {
case UIGestureRecognizerStateBegan:
{
if (!_recording)
[[PBJVision sharedInstance] startVideoCapture];
else
[[PBJVision sharedInstance] resumeVideoCapture];
break;
}
case UIGestureRecognizerStateEnded:
case UIGestureRecognizerStateCancelled:
case UIGestureRecognizerStateFailed:
{
[[PBJVision sharedInstance] pauseVideoCapture];
break;
}
default:
break;
}
}
//拍攝完成
- (void)_handleDoneButton:(UIButton *)button
{
[self _endCapture];
}
//儲存視訊
- (void)vision:(PBJVision *)vision capturedVideo:(NSDictionary *)videoDict error:(NSError *)error
{
NSString *videoPath = [_currentVideo objectForKey:PBJVisionVideoPathKey];
[_assetLibrary writeVideoAtPathToSavedPhotosAlbum:[NSURL URLWithString:videoPath] completionBlock:^(NSURL *assetURL, NSError *error1) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle: @"Saved!" message: @"Saved to the camera roll."
delegate:self
cancelButtonTitle:nil
otherButtonTitles:@"OK", nil];
[alert show];
}];
}