1.session开始运行
-[RTAVVideoCaputre sessionDidStartRunning:]
notif = NSConcreteNotification 0x1740536b0
{name = AVCaptureSessionDidStartRunningNotification; object = <AVCaptureSession: 0x1700142f0 [AVCaptureSessionPreset1280x720]>
<AVCaptureDeviceInput: 0x17002d320 [Back Camera]> -> <AVCaptureStillImageOutput: 0x17402e380>
<AVCaptureDeviceInput: 0x17002d320 [Back Camera]> -> <AVCaptureVideoDataOutput: 0x17002d380>
<AVCaptureDeviceInput: 0x17002d320 [Back Camera]> -> <AVCaptureVideoPreviewLayer: 0x17402e420>}
2.电话打进来,收到打断通知
-[RTAVVideoCaputre captureSessionWasInterrupt:] [Line 39] notif = NSConcreteNotification 0x170053e60 {name = AVCaptureSessionWasInterruptedNotification; object = <AVCaptureSession: 0x1700142f0 [AVCaptureSessionPreset1280x720]>
<AVCaptureDeviceInput: 0x17002d320 [Back Camera]> -> <AVCaptureStillImageOutput: 0x17402e380>
<AVCaptureDeviceInput: 0x17002d320 [Back Camera]> -> <AVCaptureVideoDataOutput: 0x17002d380>
<AVCaptureDeviceInput: 0x17002d320 [Back Camera]> -> <AVCaptureVideoPreviewLayer: 0x17402e420>; userInfo = {
AVCaptureSessionInterruptionReasonKey = 1;
}}
3.app进入后台,session停止通知
-[RTAVVideoCaputre sessionDidStopRunning:] [Line 47] notif = NSConcreteNotification 0x170053e60 {name = AVCaptureSessionDidStopRunningNotification; object = <AVCaptureSession: 0x1700142f0 [AVCaptureSessionPreset1280x720]>
<AVCaptureDeviceInput: 0x17002d320 [Back Camera]> -> <AVCaptureStillImageOutput: 0x17402e380>
<AVCaptureDeviceInput: 0x17002d320 [Back Camera]> -> <AVCaptureVideoDataOutput: 0x17002d380>
<AVCaptureDeviceInput: 0x17002d320 [Back Camera]> -> <AVCaptureVideoPreviewLayer: 0x17402e420>}
4.电话结束,收到打断结束通知
-[RTAVVideoCaputre sessionInterruptionEnded:] [Line 43] notif = NSConcreteNotification 0x170052f60 {name = AVCaptureSessionInterruptionEndedNotification; object = <AVCaptureSession: 0x1700142f0 [AVCaptureSessionPreset1280x720]>
<AVCaptureDeviceInput: 0x17002d320 [Back Camera]> -> <AVCaptureStillImageOutput: 0x17402e380>
<AVCaptureDeviceInput: 0x17002d320 [Back Camera]> -> <AVCaptureVideoDataOutput: 0x17002d380>
<AVCaptureDeviceInput: 0x17002d320 [Back Camera]> -> <AVCaptureVideoPreviewLayer: 0x17402e420>}
5.打断结束后,默认session自动restart通知
-[RTAVVideoCaputre sessionDidStartRunning:] [Line 51] notif = NSConcreteNotification 0x170052f60 {name = AVCaptureSessionDidStartRunningNotification; object = <AVCaptureSession: 0x1700142f0 [AVCaptureSessionPreset1280x720]>
<AVCaptureDeviceInput: 0x17002d320 [Back Camera]> -> <AVCaptureStillImageOutput: 0x17402e380>
<AVCaptureDeviceInput: 0x17002d320 [Back Camera]> -> <AVCaptureVideoDataOutput: 0x17002d380>
<AVCaptureDeviceInput: 0x17002d320 [Back Camera]> -> <AVCaptureVideoPreviewLayer: 0x17402e420>}
用系统提供的通知
这样object应该传 session实例,传nil 好像也可用,但是穿个其他的通知收不到,还是没有发出来??
//session 已经运转
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sessionDidStartRunning:) name:AVCaptureSessionDidStartRunningNotification object:@{@"name":@"小明",@"心别":@"man"}];