Camera Selection

Camera selection

All the components providing camera stream sending capabilities (the CameraStreamSender facade, or the underlying components WebcamTextureStreamSender or NativeCameraStreamSender) support camera selection.

All the following methods can be used on any of them.

Find available camera

To obtain a list of available camera, you cna use RefreshWebcamDevices:

cameraStreamSender.RefreshWebcamDevices(callback: (List<WebcamInfo> webcamDevices) => { 
    /* ... * /
}));

Note: On webGL, this call will ask to the user to provide camera access.

To access to cached result of this call (without triggering a new refresh):

cameraStreamSender.GetDiscoveredWebcamDevices();

Select a camera

To select a camera, the various SelectWebcam methods can be used. for instance, with the webcam name (can be find in WebcamInfo.name):

cameraStreamSender.SelectWebcam(webcamName);

If the stream is already started, it is possible to ask for an immediate reconnection with this new camera:

cameraStreamSender.SelectWebcam(webcamName, restartIfAlreadySending: true);

Camera selection demo

To see a demonstration of the camera selection capabilities, please look at the demonstration scene 08-WebcamSelectionAndControl.

Back to top