How to record a video in iOS

前端 未结 4 1428
故里飘歌
故里飘歌 2020-12-29 17:19

Hi I would like to record a video in iPhone through Objective-C. Can someone provide me the sample code to write my own code. I have no idea how to do it. And i need it in h

相关标签:
4条回答
  • 2020-12-29 18:03

    AV Foundation Framework is the new way to record video and audio on iOS and Mac.

    http://developer.apple.com/library/ios/#documentation/AudioVideo/Conceptual/AVFoundationPG/Articles/00_Introduction.html#//apple_ref/doc/uid/TP40010188

    It gives you much more control over focus, lighting etc...

    0 讨论(0)
  • 2020-12-29 18:03

    See Apple's overview of "Taking Pictures and Movies" here.

    For a quick solutions, you should use UIImagePicker, which allows you to capture photos/video in your application using Apple's UI.

    The Apple documentation for this class is here: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIImagePickerController_Class/UIImagePickerController/UIImagePickerController.html

    0 讨论(0)
  • 2020-12-29 18:08
    if ([UIImagePickerController
         isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
        UIImagePickerController *picker = [[UIImagePickerController alloc] init];
        picker.modalTransitionStyle = UIModalPresentationFullScreen;
        picker.sourceType = UIImagePickerControllerSourceTypeCamera;
        picker.showsCameraControls = YES;
        picker.delegate = self;
        picker.mediaTypes = @[(id)kUTTypeMovie];
        [self presentViewController:picker animated:YES  // self is a viewController
                         completion:^ {
                         }];
    }
    
    0 讨论(0)
  • 2020-12-29 18:17

    You should typically use the highest-level abstraction available that allows you to perform the tasks you want. For example, in iOS:

    • If you simply want to play movies, you can use the Media Player Framework (MPMoviePlayerController or MPMoviePlayerViewController), or for web-based media you could use a UIWebView object.

    • To record video when you need only minimal control over format, use the UIKit framework (UIImagePickerController).

    AV Foundation is one of several frameworks that you can use to play and create time-based audiovisual media. It provides an Objective-C interface you use to work on a detailed level with time-based audiovisual data. For example, you can use it to examine, create, edit, or reencode media files. You can also get input streams from devices and manipulate video during realtime capture and playback.

    via - Apple

    0 讨论(0)
提交回复
热议问题