CameraFeedClient
public sealed class CameraFeedClient : IDisposable
Namespace: AR51.Unity.SDK (transport assembly, separate from .Client).
The caller-facing client for a remote CVS camera-feed endpoint. Obtain one from the live connection — it lets you enumerate remote cameras, fetch their CvsCameraInfo, register a frame listener to receive JPG frames, and drive remote recording.
You don't construct it directly; get it from ServiceManager.Server:
var client = ServiceManager.Server.GetCameraFeedClient(address, port);
GetCameraFeedClient(address, port) is on the transport ServiceContainer exposed by ServiceManager.Server; use CameraService for local device capture, and RenderService to composite a remote feed with holograms.
AR 51 mocap and camera positions are Unity world-space meters; FOV/angle results are in degrees. The CvsCameraInfo extrinsic matrix is the camera's world pose in meters (handedness-corrected — see below).
CameraFeedClient owns a transport connection and implements IDisposable. Dispose() it (or wrap it in using) when you're done so the underlying connection is released.
Properties
| Property | Type | Description |
|---|---|---|
| Endpoint | ||
Address | string | the remote camera-feed host address |
Port | int | the remote camera-feed port |
EndPoint | string | the resolved "address:port" endpoint |
IsConnected | bool | true while the client's transport connection is live |
Method summary
Cameras
| Method | Returns | |
|---|---|---|
GetCameraInfo | CvsCameraInfo | |
GetAvailableCameras | CvsCameraInfo[] | |
GetAvailableCamerasAsync | Task<CvsCameraInfo[]> | async |
TryGetRealCameraInfos | CvsCameraInfo[] | |
TryGetRealCameraInfosAsync | Task<CvsCameraInfo[]> | async |
Frame listeners
| Method | Returns | |
|---|---|---|
Register | void | |
Unregister | void |
Recording
| Method | Returns | |
|---|---|---|
GetRecordingReady | void | |
StartRecordingAsync | void | async |
StopRecordingAsync | void | async |
StopRecording | void |
Lifetime
| Method | Returns | |
|---|---|---|
Stop | void | |
Disconnect | void | |
Dispose | void | IDisposable |
→ Full descriptions in Method details below.
Method details
GetCameraInfo
public CvsCameraInfo GetCameraInfo(string cameraId);
Fetches the current CvsCameraInfo for one camera by id (resolution, frame rate, connection state, and the packed intrinsic/extrinsic matrices).
Id (see CvsCameraInfo.Id)GetAvailableCameras
public CvsCameraInfo[] GetAvailableCameras();
public Task<CvsCameraInfo[]> GetAvailableCamerasAsync();
Enumerates every camera the remote endpoint advertises, including synthetic/relayed cameras. Use the …Async form off the Unity main thread to avoid blocking.
var client = ServiceManager.Server.GetCameraFeedClient(address, port);
foreach (CvsCameraInfo cam in client.GetAvailableCameras())
Debug.Log($"{cam.Id}: {cam.Width}x{cam.Height} @ {cam.FrameRate}fps connected={cam.IsConnected}");
TryGetRealCameraInfos
public CvsCameraInfo[] TryGetRealCameraInfos(); // excludes synthetic/relayed cameras
public Task<CvsCameraInfo[]> TryGetRealCameraInfosAsync();
Like GetAvailableCameras but filtered to real (physical) cameras — synthetic / relayed cameras are excluded. Prefer this when you only want to place or render actual hardware views.
Register
public void Register(string cameraId, ICameraFeedListener listener);
Subscribes a listener to a camera's frame stream. The listener receives JPG frames via its OnCameraFeedReceived callback. (ICameraFeedListener is a transport interface — see the Connection area.)
OnCameraFeedReceivedclass FeedSink : ICameraFeedListener
{
public void OnCameraFeedReceived(byte[] jpg) { /* decode / display */ }
}
var sink = new FeedSink();
client.Register("cam-0", sink);
// …later
client.Unregister("cam-0", sink);
Unregister
public void Unregister(string cameraId, ICameraFeedListener listener);
Removes a previously registered listener from a camera so it stops receiving frames. Pass the same cameraId/listener pair you registered.
GetRecordingReady
public void GetRecordingReady(string cameraId, string fileName);
Prepares the remote side to record the named camera into fileName (call before StartRecordingAsync).
StartRecordingAsync
public void StartRecordingAsync(string cameraId);
Starts remote recording of the camera's feed. Pair with GetRecordingReady (to set the output file) and stop with StopRecording / StopRecordingAsync.
client.GetRecordingReady("cam-0", "session-01.mp4");
client.StartRecordingAsync("cam-0");
// …later
client.StopRecording("cam-0");
StopRecording
public void StopRecording(string cameraId);
public void StopRecordingAsync(string cameraId);
Stops a recording started with StartRecordingAsync. Use the …Async variant when you don't want to block the caller.
Stop
public void Stop();
Stops the client's active feed/recording work without tearing down the connection.
Disconnect
public void Disconnect();
Closes the transport connection to the remote camera-feed endpoint. After this, IsConnected is false.
Dispose
public void Dispose();
Releases the client and its underlying connection. Call when you're done, or use a using block. After disposal the instance must not be reused.
using var client = ServiceManager.Server.GetCameraFeedClient(address, port);
var cams = client.GetAvailableCameras();
// client is disposed at end of scope
CvsCameraInfo
proto message · transportmessage CvsCameraInfo
Namespace: AR51.GRPC.CVS (proto-generated, in the transport assembly).
The camera data model the client receives via CameraFeedClient and RenderService. It carries the camera's identity, resolution, frame rate, connection state, and packed intrinsic/extrinsic/distortion matrices.
Because CvsCameraInfo is a generated proto type, its matrices arrive as packed bytes. Don't unpack them by hand — the documented, usable API is the Extensions helpers below, which return Unity Matrix4x4/FOV values.
Fields
| Field | Type | Description |
|---|---|---|
| Identity | ||
Id | string | camera identifier |
CameraType | string | camera type label |
| Image | ||
Width | int32 | image width in pixels |
Height | int32 | image height in pixels |
FrameRate | int32 | frames per second |
| State | ||
IsConnected | bool | whether the camera is currently connected |
IsRemote | bool | whether the camera is relayed from a remote source |
RemoteEndpoint | string | endpoint of the remote source (when IsRemote) |
| Calibration (packed) | ||
Intrisic | bytes | 4×4 intrinsic matrix, row-major float[16] (packed) — [sic] spelling |
Extrensic | bytes | 4×4 extrinsic (camera pose) matrix, float[16] (packed) — [sic] spelling |
Distortion | bytes | distortion coefficients (packed) |
⚠️ The Intrisic and Extrensic field names are misspelled in the proto [sic] — preserved here because that's the wire name you'll see on the type. Read them through the helpers below rather than touching the raw bytes.
Extensions helpers (on CvsCameraInfo)
public static class Extensions — namespace AR51.Unity.SDK. These unpack the packed matrices into Unity types and are the documented, usable API for CvsCameraInfo. See the full helper list on the Extensions page.
public static Matrix4x4 GetIntrisic(this CvsCameraInfo info); // unpacks Intrisic → Unity Matrix4x4
public static Matrix4x4 GetExtrinsic(this CvsCameraInfo info); // unpacks Extrensic, handedness-corrected
public static float GetVerticalFOV(this CvsCameraInfo info); // degrees, from Height & fy
public static float GetHorizontalFOV(this CvsCameraInfo info); // degrees, from Width & fx
GetIntrisic— unpacksIntrisicinto a UnityMatrix4x4. It's a pinhole 3×3 embedded in a 4×4:fx = [0,0],fy = [1,1]. (Method name preserves the proto [sic] spelling.)GetExtrinsic— unpacksExtrensic(the camera's world pose) into aMatrix4x4, rotated 180° about Z to map the CVS y-up / right-handed convention into Unity. Translation is in meters.GetVerticalFOV— vertical field of view in degrees, derived fromHeightandfy.GetHorizontalFOV— horizontal field of view in degrees, derived fromWidthandfx.
CvsCameraInfo cam = client.GetCameraInfo("cam-0");
Matrix4x4 intrinsic = cam.GetIntrisic(); // [sic] proto spelling
Matrix4x4 worldPose = cam.GetExtrinsic(); // handedness-corrected; translation in meters
float vFov = cam.GetVerticalFOV(); // degrees
float hFov = cam.GetHorizontalFOV(); // degrees
// Place a Unity camera at the CVS camera's pose:
renderCamera.transform.position = worldPose.GetColumn(3);
renderCamera.fieldOfView = vFov; // Unity uses vertical FOV
See also
ServiceManager— providesServer.GetCameraFeedClient(address, port)RenderService— composites a remoteCvsCameraInfofeed with holograms, using these matrix/FOV helpersCameraService— local device capture (the counterpart to this remote client)Extensions— the full set ofCvsCameraInfoandCore↔Unity helpers- Connection & Services —
ServiceNames.CameraFeedService, discovery, and the transport overview - Class index — all Unity SDK types