-
-
Notifications
You must be signed in to change notification settings - Fork 36
Configuring MCamera
We mnie jest dwu ludzi, jeden zupełnie rozsądny, drugi wariat. Który zaś zwycięży?
There are numerous methods that can be used to modify the initial state of the camera. On this page we'll discuss them all and then I'll show you how to use them correctly.
-
func setCameraOutputType(_ cameraOutputType: CameraOutputType) -> Self
- Changes the initial camera output type.
-
func setCameraPosition(_ cameraPosition: CameraPosition) -> Self
- Changes the initial camera position.
- If the selected camera position is not available, the camera will not be changed.
-
func setAudioAvailability(_ isAvailable: Bool) -> Self
- Definies whether the audio source is available.
- If disabled, the camera will not record audio, and will not ask for permission to access the microphone.
-
func setZoomFactor(_ zoomFactor: CGFloat) -> Self
- Changes the initial camera zoom level.
- If the zoom factor is out of bounds, it will be set to the closest available value.
-
func setFlashMode(_ flashMode: CameraFlashMode) -> Self
- Changes the initial camera flash mode.
- If the selected flash mode is not available, the flash mode will not be changed.
-
func setLightMode(_ lightMode: CameraLightMode) -> Self
- Changes the initial light (torch / flashlight) mode.
- If the selected light mode is not available, the light mode will not be changed.
-
func setResolution(_ resolution: AVCaptureSession.Preset) -> Self
- Changes the initial camera resolution.
- Changing the resolution may affect the maximum frame rate that can be set.
-
func setFrameRate(_ frameRate: Int32) -> Self
- Changes the initial camera frame rate.
- Depending on the resolution of the camera and the current specifications of the device, there are some restrictions on the frame rate that can be set. If you set a frame rate that exceeds the camera's capabilities, the library will automatically set the closest possible value and show you which value has been set.
-
func setCameraExposureDuration(_ duration: CMTime) -> Self
- ff
-
func setCameraTargetBias(_ targetBias: Float) -> Self
- ff
-
func setCameraISO(_ iso: Float) -> Self
- ff
-
func setCameraExposureMode(_ exposureMode: AVCaptureDevice.ExposureMode) -> Self
- ff
-
func setCameraHDRMode(_ hdrMode: CameraHDRMode) -> Self
- ff
-
func setCameraFilters(_ filters: [CIFilter]) -> Self
- ff
-
func setMirrorOutput(_ shouldMirror: Bool) -> Self
- ff
-
func setGridVisibility(_ shouldShowGrid: Bool) -> Self
- ff
-
func setFocusImage(_ image: UIImage) -> Self
- ff
-
func setFocusImageColor(_ color: UIColor) -> Self
- ff
-
func setFocusImageSize(_ size: CGFloat) -> Self
- ff
-
func setCameraScreen(_ builder: @escaping CameraScreenBuilder) -> Self
- ff
-
func setCapturedMediaScreen(_ builder: CapturedMediaScreenBuilder?) -> Self
- ff
-
func setErrorScreen(_ builder: @escaping ErrorScreenBuilder) -> Self
- ff
-
func lockCameraInPortraitOrientation(_ appDelegate: MApplicationDelegate.Type) -> Self
- ff
-
func setCloseMCameraAction(_ action: @escaping () -> ()) -> Self
- ff
-
func onImageCaptured(_ action: @escaping (UIImage, MCamera.Controller) -> ()) -> Self
- ff
-
func onVideoCaptured(_ action: @escaping (URL, MCamera.Controller) -> ()) -> Self
- ff
To call the selected method(s), simply add them to MCamera. Do not forget to insert startSession()
at the end, otherwise the MCamera
will not start!