MultiCameraDevice
namespace VideoKit {
/// <summary>
/// Multi-camera device for streaming pixel buffers from multiple cameras simultaneously.
/// </summary>
class MultiCameraDevice { ... }
}
The MultiCameraDevice
is a composite device which enables streaming pixel buffers
from multiple CameraDevice
instances simultaneously.
MultiCameraDevice
is currently supported only on Android and iOS. Other platforms will never discover
any available MultiCameraDevice
instances.
Discovering Multi-Camera Devices
INCOMPLETE
Checking for Permissions
/// <summary>
/// Check the current camera permission status.
/// </summary>
/// <param name="request">Request permissions if the user has not yet been asked.</param>
/// <returns>Current camera permissions status.</returns>
static Task<PermissionStatus> CheckPermissions (bool request = true);
INCOMPLETE
/// <summary>
/// Device permissions status.
/// </summary>
enum PermissionStatus : int {
/// <summary>
/// User has not authorized or denied access to media device.
/// </summary>
Unknown = 0,
/// <summary>
/// User has denied access to media device.
/// </summary>
Denied = 2,
/// <summary>
/// User has authorized access to media device.
/// </summary>
Authorized = 3
}
Discovering Multi-Camera Devices
/// <summary>
/// Discover available multi-camera devices.
/// </summary>
static Task<MultiCameraDevice[]> Discover ();
INCOMPLETE
Identifying the Device
Multi-camera devices can be identified in several ways:
Inspecting the Unique Identifier
/// <summary>
/// Multi-camera unique ID.
/// </summary>
string uniqueId { get; }
The multi-camera device reports its unique identifier as a string.
Inspecting the Camera Name
/// <summary>
/// Display friendly camera name.
/// </summary>
string name { get; }
The multi-camera device reports its name as a human-friendly string.
Accessing Contained Cameras
/// <summary>
/// Camera devices that comprise this multi-camera device.
/// </summary>
CameraDevice[] cameras { get; }
INCOMPLETE
Streaming Pixel Buffers
The MultiCameraDevice
streams pixel buffers from its contained cameras
simultaneously.
Checking the Streaming Status
/// <summary>
/// Whether the device is running.
/// </summary>
bool running { get; }
The multi-camera device reports whether it is currently streaming sample buffers.
Each contained camera within the multi-camera device can also be paused or resumed, in which case
the IsRunning
method can be used to check whether a contained camera is streaming:
/// <summary>
/// Check whether a given camera in the multi-camera device is running.
/// </summary>
/// <param name="camera">Camera device. MUST be a member of this multi-camera device.</param>
bool IsRunning (CameraDevice camera);
Starting the Stream
/// <summary>
/// Start running.
/// </summary>
/// <param name="handler">Delegate to receive preview frames.</param>
void StartRunning (Action<CameraDevice, PixelBuffer> handler);
INCOMPLETE
The provided handler
is invoked on a dedicated camera thread, not the Unity main thread.
Stopping the Stream
/// <summary>
/// Stop running.
/// </summary>
void StopRunning ();
When the multi-camera device is running, this method can be used to stop streaming pixel buffers from all cameras and cleanup resources.
Pausing a Camera Stream
/// <summary>
/// Stop the camera preview from a specific camera in the multi-camera device.
/// </summary>
/// <param name="camera">Camera device. MUST be a member of this multi-camera device.</param>
void StopRunning (CameraDevice camera);
INCOMPLETE
Resuming a Camera Stream
/// <summary>
/// Start the camera preview from a given camera in the multi-camera device.
/// </summary>
/// <param name="camera">Camera device. MUST be a member of this multi-camera device.</param>
void StartRunning (CameraDevice camera);
INCOMPLETE
Managing System Pressure
INCOMPLETE
Inspecting the Hardware Cost
/// <summary>
/// Get the multi-camera device normalized hardware cost in range [0.0, 1.0].
/// </summary>
float? hardwareCost { get; }
INCOMPLETE
Not all multi-camera devices report a hardwareCost
. These devices will return null
.
Inspecting the System Pressure Cost
/// <summary>
/// Get the multi-camera device normalized system pressure cost in range [0.0, 1.0].
/// </summary>
float? systemPressureCost { get; }
INCOMPLETE
Not all multi-camera devices report a systemPressureCost
. These devices will return null
.
Listening for System Pressure Changes
/// <summary>
/// Event raised when the system pressure level changes.
/// </summary>
event Action? onSystemPressureChange { add; remove; }
INCOMPLETE
This event is invoked on a dedicated camera thread, not on the Unity main thread.