| 
									
										
										
										
											2023-10-13 18:33:20 +02:00
										 |  |  | // | 
					
						
							|  |  |  | //  CameraSessionDelegate.swift | 
					
						
							|  |  |  | //  VisionCamera | 
					
						
							|  |  |  | // | 
					
						
							|  |  |  | //  Created by Marc Rousavy on 11.10.23. | 
					
						
							|  |  |  | //  Copyright © 2023 mrousavy. All rights reserved. | 
					
						
							|  |  |  | // | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import AVFoundation | 
					
						
							|  |  |  | import Foundation | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  A listener for [CameraSession] events | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | protocol CameraSessionDelegate: AnyObject { | 
					
						
							|  |  |  |   /**
 | 
					
						
							|  |  |  |    Called when there is a Runtime Error in the [CameraSession] | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   func onError(_ error: CameraError) | 
					
						
							|  |  |  |   /**
 | 
					
						
							|  |  |  |    Called when the [CameraSession] successfully initializes | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   func onSessionInitialized() | 
					
						
							| 
									
										
										
										
											2024-08-02 14:39:23 +01:00
										 |  |  |    | 
					
						
							|  |  |  |   func onCameraConfigurationChanged(_ configuration: CameraConfiguration?, _ difference: CameraConfiguration.Difference?) | 
					
						
							| 
									
										
										
										
											2023-12-09 21:09:55 +03:00
										 |  |  |   /**
 | 
					
						
							|  |  |  |    Called when the [CameraSession] starts streaming frames. (isActive=true) | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   func onCameraStarted() | 
					
						
							|  |  |  |   /**
 | 
					
						
							|  |  |  |    Called when the [CameraSession] stopped streaming frames. (isActive=false) | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   func onCameraStopped() | 
					
						
							| 
									
										
										
										
											2023-10-13 18:33:20 +02:00
										 |  |  |   /**
 | 
					
						
							|  |  |  |    Called for every frame (if video or frameProcessor is enabled) | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   func onFrame(sampleBuffer: CMSampleBuffer) | 
					
						
							| 
									
										
										
										
											2024-07-15 09:50:39 +01:00
										 |  |  |   /**
 | 
					
						
							|  |  |  |    Called whenever a new video chunk is available | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   func onVideoChunkReady(chunk: ChunkedRecorder.Chunk) | 
					
						
							| 
									
										
										
										
											2023-10-13 18:33:20 +02:00
										 |  |  |   /**
 | 
					
						
							|  |  |  |    Called whenever a QR/Barcode has been scanned. Only if the CodeScanner Output is enabled | 
					
						
							|  |  |  |    */ | 
					
						
							| 
									
										
										
										
											2023-11-09 11:57:05 +01:00
										 |  |  |   func onCodeScanned(codes: [CameraSession.Code], scannerFrame: CameraSession.CodeScannerFrame) | 
					
						
							| 
									
										
										
										
											2023-10-13 18:33:20 +02:00
										 |  |  | } |