FaceCamViewer显示实时摄像头窗口

联合创作 · 2023-09-27 09:09

FaceCamViewer 显示一个实时的摄像头窗口,类似 FaceTime。

环境配置

  • AVFoundation.framework
  • QuartzCore.framework

用法

将 FaceCamViewer.h 和 FaceCamViewer.m 复制到您的项目中。

导入#import "FaceCamViewer.h"要显示相机源的位置。

基本实现:

FaceCamViewer  * viewer = [[ FaceCamViewer alloc ] initWithDeviceType:IPHONE3x5 ];
[viewer startFaceCam];
[ self .view addSubview: viewer];

带有选项的实施:

FaceCamViewer  * viewer3 = [[ FaceCamViewer alloc] initWithFrame:方法CGRectMake190290120160)];
viewer3.cameraType =  AVCaptureDevicePositionBack ;

AVCaptureSession  * session = [[ AVCaptureSession alloc] init];
viewer3.session = session;

viewer3.draggable =  YES ;

[viewer3 startFaceCam];
[ self .view addSubview: viewer3];

选件

initWithDeviceType-设置预定的摄像机视框

  • IPHONE3x5
  • IPHONE4
  • IPAD

摄像头类型(可选

  • AVCaptureDevicePositionFront(默认前置
  • AVCaptureDevicePositionBack

session(可选)- 设置 AVCaptureSession

可拖动的(可选)- 允许视图可拖动

浏览 7
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报