SOSCameraBaseViewController

The SOSCameraBaseViewController serves as the base controller which manages interactions between the UI and SOS backend for the camera phase of SOS.

If you wish to replace the camera UI, your class must implement this base class.

All method overrides require a call back to super for SOS to function properly.

  • This will trigger a transition to the , and mark the SOS Session as being in the screen sharing phase. At this point the camera phase is ending, and the view controller will attempt to clean up.

    Warning

    Please ensure that your view controller cleans up entirely. Any reference cycles will result in additional instances of this view controller in memory when returning to the camera phase.

    Declaration

    Objective-C

    - (void)handleScreenSharingTransition:(id)sender;

    Parameters

    sender

    The object which triggered the action.

  • Action performed when switching the current device capture position.

    This method will automatically call <[SOSCameraBaseViewController setDevicePosition:]> with the opposite camera value; for example, switching from front to back. If the SOS session has only been configured with one available camera this method will have no effect.

    If you wish to handle the device position in a different way, you can ignore this action and use <[SOSCameraBaseViewController setDevicePosition:]> directly instead.

    Warning

    This method is used to communicate between the UI API and the SOS backend. If you wish to override this method you can do so safely; however you must call this method on super. Failure to do so will result in undefined and likely broken behavior from SOS.

    Declaration

    Objective-C

    - (void)handleToggleDevicePosition:(id)sender;

    Parameters

    sender

    The object which triggered the action.

  • Required method to instruct the backend to toggle the current AVDeviceCapturePosition used for transmitting the device camera.

    Warning

    This method is used to communicate between the UI API and the SOS backend. If you wish to override this method you can do so safely; however you must call this method on super. Failure to do so will result in undefined and likely broken behavior from SOS.

    Declaration

    Objective-C

    - (void)setDevicePosition:(AVCaptureDevicePosition)position;

    Parameters

    position

    The current desired camera capture position.

  • Required method to call to get the current AVCaptureDevicePosition state of the SOS Session.

    Warning

    This method is used to communicate between the UI API and the SOS backend. If you wish to override this method you can do so safely; however you must call this method on super. Failure to do so will result in undefined and likely broken behavior from SOS.

    Declaration

    Objective-C

    - (AVCaptureDevicePosition)currentDevicePosition;

    Return Value

    The current AVCaptureDevicePosition state of the SOS Session.

  • Returns the proper initial camera position for the 2-way capture device. (Front or Back)

    This is determined by several factors, including device availability and the configuration in the object.

    You can optionally choose to override this method to return whatever device position you choose, however it is recommended that you continue to use the object to define session behavior.

    Warning

    If no camera is available this will return AVCaptureDevicePositionUnspecified.

    Declaration

    Objective-C

    - (AVCaptureDevicePosition)resolveInitialDevicePosition;

    Return Value

    The initial device position.

  • Determines whether or not the provided position is configured to be available for an SOS Session.

    This will allow you to easily check whether the current SOS session is configured to allow the provided position. You can optionally choose to override this method to allow any position. However, we recommend that you continue to use the object to define session behavior.

    Declaration

    Objective-C

    - (BOOL)devicePositionAvailable:(AVCaptureDevicePosition)position;

    Parameters

    position

    The position you wish to check.

    Return Value

    Whether the provided position is valid for the current session.