UpdateVideoInput (Unity)
- Declaration
public static void UpdateVideoInput(CavrnusVideoInputDevice device)
- Description
Sets which camera the user wishes to use. Note that the CavrnusVideoInputDevice
provided to this function can only be acquired by calling FetchVideoInputs to search for available cameras.
- Sample
public class VideoInputSelector : MonoBehaviour
{
private List<CavrnusVideoInputDevice> videoDevices;
private int currentDeviceIndex = 0;
private void Start()
{
CavrnusFunctionLibrary.AwaitAnySpaceConnection(spaceConn => {
CavrnusFunctionLibrary.FetchVideoInputs(devices => {
videoDevices = devices;
});
});
}
public void SelectNextVideoSource()
{
if (videoDevices.Count == 0)
{
Debug.LogWarning("No video devices available.");
return;
}
currentDeviceIndex = (currentDeviceIndex + 1) % videoDevices.Count;
CavrnusFunctionLibrary.UpdateVideoInput(videoDevices[currentDeviceIndex]);
}
}