3

だから私はこの基本的なビデオ録画アプリケーションを動作させていますが、ビデオキャプチャのフレームレート (正しい用語だと思います) をどのように設定できるのか疑問に思っています。遅いぼやけた効果を与えるために、録画時にもキャプチャされるキャプチャレートは?

これまでの私のコードは次のとおりです: HEADER

//  ViewController.h
//  VideoTest  
//
// 

#import <UIKit/UIKit.h>
#import <MediaPlayer/MediaPlayer.h>
#import <MobileCoreServices/MobileCoreServices.h>

@interface ViewController : UIViewController <UIImagePickerControllerDelegate,  UINavigationControllerDelegate>

@property (copy,   nonatomic) NSURL *movieURL;
@property (strong, nonatomic) MPMoviePlayerController *movieController;

- (IBAction)takeVideo:(UIButton *)sender;
@end

実装:

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad
{
//    Check if the unit has a camera
if (![UIImagePickerController     isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {

    UIAlertView *myAlertView = [[UIAlertView alloc] initWithTitle:@"Oops"
                                                          message:@"Sorry but this device  has no camera."
                                                         delegate:nil
                                                cancelButtonTitle:@"OK"
                                                otherButtonTitles: nil];

    [myAlertView show];

}else{
[super viewDidLoad];
}

}

- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
//  Capture Video Action
- (IBAction)takeVideo:(UIButton *)sender {

UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.allowsEditing = YES;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.mediaTypes = [[NSArray alloc] initWithObjects: (NSString *) kUTTypeMovie, nil];

[self presentViewController:picker animated:YES completion:NULL];

 }

- (void)imagePickerController:(UIImagePickerController *)picker  didFinishPickingMediaWithInfo:(NSDictionary *)info {

self.movieURL = info[UIImagePickerControllerMediaURL];

[picker dismissViewControllerAnimated:YES completion:NULL];

}
//  Recording Cancelled
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {

[picker dismissViewControllerAnimated:YES completion:NULL];

}

- (void)viewDidAppear:(BOOL)animated {

self.movieController = [[MPMoviePlayerController alloc] init];

[self.movieController setContentURL:self.movieURL];
[self.movieController.view setFrame:CGRectMake (0, 0, 320, 476)];
[self.view addSubview:self.movieController.view];

[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(moviePlayBackDidFinish:)
                                               name:MPMoviePlayerPlaybackDidFinishNotification
                                           object:self.movieController];



[self.movieController play];

}
//  Playback ended

- (void)moviePlayBackDidFinish:(NSNotification *)notification {

[[NSNotificationCenter defaultCenter]removeObserver:self  name:MPMoviePlayerPlaybackDidFinishNotification object:nil];

[self.movieController stop];
[self.movieController.view removeFromSuperview];
self.movieController = nil;

}

@end
4

0 に答える 0