录像
2015-10-16 04:52
309 查看
//
// ViewController.m
// UI-NO.22录像
//
// Created by Bruce on 15/8/20.
// Copyright (c) 2015年 Bruce. All rights reserved.
//
#import "ViewController.h"
#import <AVFoundation/AVFoundation.h>
#import <MobileCoreServices/MobileCoreServices.h>
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// UIImagePickerController 图像采取控制器
// 可以用来选取图片 拍照 录像
UIImagePickerController *picker = [[UIImagePickerController alloc]init];
// UIImagePickerControllerSourceTypePhotoLibrary, 图片库
// UIImagePickerControllerSourceTypeCamera, 摄像头
// UIImagePickerControllerSourceTypeSavedPhotosAlbum 相册
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.mediaTypes = @[(NSString *)kUTTypeMovie];
// 视频录制最大时长
picker.videoMaximumDuration = 10;
// 录制视频的质量
picker.videoQuality = UIImagePickerControllerQualityTypeLow;
// 是否显示摄像头控制面板
picker.showsCameraControls = YES;
// 设置摄像头拍照或录像
picker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModeVideo;
// 设置 前后摄像头
picker.cameraDevice = UIImagePickerControllerCameraDeviceFront;
// 设置闪光灯的类型
picker.cameraFlashMode = UIImagePickerControllerCameraFlashModeAuto;
[self presentViewController:picker animated:YES completion:nil];
// 拍照
// [picker takePicture];
// 开始录像
[picker startVideoCapture];
// 结束录像
[picker stopVideoCapture];
// 完成操作
//完成
// -(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
// ViewController.m
// UI-NO.22录像
//
// Created by Bruce on 15/8/20.
// Copyright (c) 2015年 Bruce. All rights reserved.
//
#import "ViewController.h"
#import <AVFoundation/AVFoundation.h>
#import <MobileCoreServices/MobileCoreServices.h>
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// UIImagePickerController 图像采取控制器
// 可以用来选取图片 拍照 录像
UIImagePickerController *picker = [[UIImagePickerController alloc]init];
// UIImagePickerControllerSourceTypePhotoLibrary, 图片库
// UIImagePickerControllerSourceTypeCamera, 摄像头
// UIImagePickerControllerSourceTypeSavedPhotosAlbum 相册
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.mediaTypes = @[(NSString *)kUTTypeMovie];
// 视频录制最大时长
picker.videoMaximumDuration = 10;
// 录制视频的质量
picker.videoQuality = UIImagePickerControllerQualityTypeLow;
// 是否显示摄像头控制面板
picker.showsCameraControls = YES;
// 设置摄像头拍照或录像
picker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModeVideo;
// 设置 前后摄像头
picker.cameraDevice = UIImagePickerControllerCameraDeviceFront;
// 设置闪光灯的类型
picker.cameraFlashMode = UIImagePickerControllerCameraFlashModeAuto;
[self presentViewController:picker animated:YES completion:nil];
// 拍照
// [picker takePicture];
// 开始录像
[picker startVideoCapture];
// 结束录像
[picker stopVideoCapture];
// 完成操作
//完成
// -(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
相关文章推荐
- 视频的播放
- HTTP协议(异步和同步)
- 请教SQLITE如何删除表内重复的记录
- 同步和异步请求
- 猜谜语
- 多线程3
- 多线程2
- 多线程
- Codeforces Round #326 (Div. 2) D. Duff in Beach dp
- 音乐播放
- Codeforces Round #326 (Div. 2) C. Duff and Weight Lifting 水题
- Android动画学习(缓动动画与属性动画的区别)
- Codeforces Round #326 (Div. 2) B. Duff in Love 分解质因数
- Codeforces Round #326 (Div. 2) A. Duff and Meat 水题
- PHP学习笔记(11)—— 递归
- 在eclipse下使用maven搭建Struts2,Hibernate4和Spring4开发环境
- Codeforces Round #326 Duff in the Army(主席树+LCA)
- Maximum Subarray Difference
- 我的cocos2d-x-3.2集成云风pbc lua binding方法
- eclipse环境安装&Robotium自动化测试环境安装&RobotiumRecord自动化录制环境安装