SAFR Windows SDK
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Properties Events
RealNetworks.CameraKit.CameraManager Class Reference

The camera manager is responsible for the discovery of cameras and it allows you easy access to the default camera for a camera position. More...

Public Member Functions

void AddDiscovery (CameraDiscovery discovery)
 
Camera GetCamera (CameraIdentifier identifier)
 Returns the camera for the given identifier. Nil is returned if no such camera exists. More...
 
Camera GetDefaultCamera (CameraPosition position, bool depthable=false)
 Returns the default camera. The default camera is the camera that an application should pick by default. E.g. a built-in camera that is guaranteed to exist and that produces good results. Nil is returned if the discovery has no concept of a default camera. More...
 
async Task TriggerDiscovery ()
 Triggers a new round of camera discovery. Listen to the discovery start and end notifications to learn when discovery has ended. More...
 
Camera AddCamera (CameraType type, string name, Uri uri)
 Adds camera of type with name / uri. More...
 
void RemoveCamera (CameraIdentifier identifier)
 Removes the camera with the given camera identifier. Does nothing if no such camera exists. More...
 
string ExternalizedCameras ()
 Creates an externalized list of all cameras and their configurations. You may store this information persistently. More...
 
void InternalizeCameras (string data)
 Takes an externalized camera list and applies it to the camera manager: More...
 
CameraCredentialsGetCredentials (CameraIdentifier identifier)
 Returns the credentials for the camera identified by the given camera identifier. Returns nil if the camera manager has no persisted credentials for this camera. More...
 
void SaveCredentials (CameraCredentials credentials, CameraIdentifier identifier)
 Saves the given credentials for the camera identified by 'identifier'. More...
 

Properties

static CameraManager Shared [get]
 The shared camera manager. More...
 
List< CameraAvailableCameras [get]
 Returns all available cameras. More...
 
Camera DefaultCamera [get]
 Returns the default camera as specified by the OS. This may be a front- or back-facing camera. More...
 

Events

EventHandler WillBeginDiscovery
 Event which is fired when camera discovery starts. More...
 
EventHandler DidEndDiscovery
 Event which is fired when camera discovery has ended. More...
 

Detailed Description

The camera manager is responsible for the discovery of cameras and it allows you easy access to the default camera for a camera position.

You trigger camera discovery by invoking the TriggerDiscovery function. Camera discovery operates asynchronously. You should invoke this function at least once at application startup and you may invoke it at additional times. Generically this function should invoked any time that the list of available cameras may change. For example, every time your application becomes the active application.

You should register an event handler with the DidEndDiscovery property. The camera manager will invoke this event handler every time a camera discovery session has completed. This event handler is invoked with the list of all the cameras that are known to the camera manager at this moment in time. So this list includes both newly and previously discovered cameras.

The camera manager allows you to look up a camera by its unqiue identifier and it allows you to get the default camera for a camera position. A camera position indicates where a camera is located relative to the user. For example there is a camera position for the "front camera" and another one for the "back camera". A front camera is a camera which typically faces the user while a back camera is a camera which faces away from the user.

Member Function Documentation

◆ AddCamera()

Camera RealNetworks.CameraKit.CameraManager.AddCamera ( CameraType  type,
string  name,
Uri  uri 
)

Adds camera of type with name / uri.

◆ AddDiscovery()

void RealNetworks.CameraKit.CameraManager.AddDiscovery ( CameraDiscovery  discovery)

◆ ExternalizedCameras()

string RealNetworks.CameraKit.CameraManager.ExternalizedCameras ( )

Creates an externalized list of all cameras and their configurations. You may store this information persistently.

Returns
the camera manager configuration

◆ GetCamera()

Camera RealNetworks.CameraKit.CameraManager.GetCamera ( CameraIdentifier  identifier)

Returns the camera for the given identifier. Nil is returned if no such camera exists.

Parameters
identifierthe camera identifier
Returns

◆ GetCredentials()

CameraCredentials? RealNetworks.CameraKit.CameraManager.GetCredentials ( CameraIdentifier  identifier)

Returns the credentials for the camera identified by the given camera identifier. Returns nil if the camera manager has no persisted credentials for this camera.

Parameters
identifierthe camera identifier
Returns
the credentials for the camera; null if none are available

◆ GetDefaultCamera()

Camera RealNetworks.CameraKit.CameraManager.GetDefaultCamera ( CameraPosition  position,
bool  depthable = false 
)

Returns the default camera. The default camera is the camera that an application should pick by default. E.g. a built-in camera that is guaranteed to exist and that produces good results. Nil is returned if the discovery has no concept of a default camera.

Parameters
positionthe desired camera position
depthabletrue if the camera should be able to capture depth data
Returns
the default camera; nil if no default camera exists

◆ InternalizeCameras()

void RealNetworks.CameraKit.CameraManager.InternalizeCameras ( string  data)

Takes an externalized camera list and applies it to the camera manager:

  • cameras which are in the externalized list but not in the camera manager list are added to the camera manager list
  • cameras which are in the externalized list and the camera manager list are updated in the camera manager
  • cameras which are in the camera manager list but not the externalized list are removed
Parameters
datathe new camera manager configuration

◆ RemoveCamera()

void RealNetworks.CameraKit.CameraManager.RemoveCamera ( CameraIdentifier  identifier)

Removes the camera with the given camera identifier. Does nothing if no such camera exists.

Parameters
identifierthe camera identifier

◆ SaveCredentials()

void RealNetworks.CameraKit.CameraManager.SaveCredentials ( CameraCredentials  credentials,
CameraIdentifier  identifier 
)

Saves the given credentials for the camera identified by 'identifier'.

Parameters
credentialsthe camera credentials
identifierthe camera identifier

◆ TriggerDiscovery()

async Task RealNetworks.CameraKit.CameraManager.TriggerDiscovery ( )

Triggers a new round of camera discovery. Listen to the discovery start and end notifications to learn when discovery has ended.

Property Documentation

◆ AvailableCameras

List<Camera> RealNetworks.CameraKit.CameraManager.AvailableCameras
get

Returns all available cameras.

◆ DefaultCamera

Camera RealNetworks.CameraKit.CameraManager.DefaultCamera
get

Returns the default camera as specified by the OS. This may be a front- or back-facing camera.

◆ Shared

CameraManager RealNetworks.CameraKit.CameraManager.Shared
staticget

The shared camera manager.

Event Documentation

◆ DidEndDiscovery

EventHandler RealNetworks.CameraKit.CameraManager.DidEndDiscovery

Event which is fired when camera discovery has ended.

◆ WillBeginDiscovery

EventHandler RealNetworks.CameraKit.CameraManager.WillBeginDiscovery

Event which is fired when camera discovery starts.