Camera

Overview

The Camera class provides the functionality for capturing photos and videos. To get information about a photo that was just taken, subscribe to captureInfoObservable

The following code snippet demonstrates how to use the Camera class to take a photo.


CoreManager.shared().camera.takePhoto()
            .do(onError: { error in
                // capture photo failed
            }, onCompleted: {
                //capture photo succeeded
            })
            .subscribe()
            .disposed(by: disposeBag)
 

Before calling the above method, make sure you set the camera mode to PHOTO. This can be done using the following function (setMode).


CoreManager.shared().camera.setMode(mode: .photo)
            .do(onError: { error in
                // set mode failed
            }, onCompleted: {
                // set mode succeeded
            })
            .subscribe()
            .disposed(by: disposeBag)

The code snippet below shows how to listen to the capture info.


CoreManager.shared().camera.captureInfoObservable
            .subscribe(onNext: { info in
                    // get capture info
                }, onError: { error in
                    // error
            })
            .disposed(by: disposeBag)

Similarly, you can use the APIs in this class to capture videos and also capture photos at a specific time interval.

Camera Settings

Camera class in the SDK also provides APIs to get and set the camera settings. 

The below code snippet shows how to listen to the current settings.


CoreManager.shared().camera.currentSettingsObservable
            .subscribe(onNext: { currentSettings in
                    // get current settings
                }, onError: { error in
                    // error
            })
            .disposed(by: disposeBag)

You can also modify the camera settings using the function setSettings.

For more information about this class, please refer to the Camera class.