SOSCameraBaseViewController Class Reference

Inherits from SOSSessionBaseViewController : UIViewController
Conforms to SOSUIAgentStreamReceivable
SOSUIDeviceCameraReceivable
Declared in SOSCameraBaseViewController.h

Overview

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.

UI Action Handlers

– handleScreenSharingTransition:

This will trigger a transition to the SOSScreenSharingBaseViewController, 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.

- (IBAction)handleScreenSharingTransition:(id)sender

Parameters

sender

The object which triggered the action.

Discussion

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.

Declared In

SOSCameraBaseViewController.h

– handleToggleDevicePosition:

Action performed when switching the current device capture position.

- (IBAction)handleToggleDevicePosition:(id)sender

Parameters

sender

The object which triggered the action.

Discussion

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.

Declared In

SOSCameraBaseViewController.h

Session State Management

– setDevicePosition:

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

- (void)setDevicePosition:(AVCaptureDevicePosition)position

Parameters

position

The current desired camera capture position.

Discussion

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.

Declared In

SOSCameraBaseViewController.h

– currentDevicePosition

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

- (AVCaptureDevicePosition)currentDevicePosition

Return Value

The current AVCaptureDevicePosition state of the SOS Session.

Discussion

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.

Declared In

SOSCameraBaseViewController.h

– resolveInitialDevicePosition

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

- (AVCaptureDevicePosition)resolveInitialDevicePosition

Return Value

The initial device position.

Discussion

This is determined by several factors, including device availability and the configuration in the SOSOptions 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 SOSOptions object to define session behavior.

Warning: If no camera is available this will return AVCaptureDevicePositionUnspecified.

Declared In

SOSCameraBaseViewController.h

– devicePositionAvailable:

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

- (BOOL)devicePositionAvailable:(AVCaptureDevicePosition)position

Parameters

position

The position you wish to check.

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 SOSOptions object to define session behavior.

Return Value

Whether the provided position is valid for the current session.

Declared In

SOSCameraBaseViewController.h