Renders Rust+ camera frames (AppCameraRays) into images. A separate package so the core
RustPlusApi stays image-free — take this dependency
only if you need rendered frames. Depends on
SixLabors.ImageSharp (the 2.1.x line, which supports
netstandard2.0).
Part of RustPlusApi · Documentation · Samples
Targets .NET Standard 2.0 and .NET 10.
dotnet add package RustPlusApi.CameraCameraController manages the session (the server stops streaming rays for subscriptions
that are not renewed; the controller re-subscribes every 10 s) and exposes turret/PTZ
helpers; CameraRenderer turns the frames into PNGs:
using RustPlusApi.Camera;
var response = await CameraController.SubscribeAsync(rustPlus, "CAM01");
if (!response.IsSuccess) return;
await using var camera = response.Data!;
var renderer = new CameraRenderer(camera.Info.Width, camera.Info.Height);
camera.OnFrameReceived += (_, frame) =>
{
renderer.AddRays(frame);
byte[] png = renderer.Render(); // save / display
};
// One check per device kind: IsAutoTurret / IsDrone / IsPtzCamera / IsStaticCamera.
// Turrets: await camera.ShootAsync(); await camera.ReloadAsync();
// PTZ cameras: await camera.ZoomAsync();
// Mouse look / drone movement: await camera.LookAsync(10f, 0f); await camera.MoveAsync(CameraButtons.Forward);
// All action helpers are capability-gated: an unsupported action is refused client-side
// (RustPlusErrorCode.NotSupported) without sending — the server acks unsupported inputs
// with success while ignoring them, and zoom shares FirePrimary with turret fire.
// Raised when a renewal fails (e.g. NoPlayer after the camera was destroyed in game):
camera.OnKeepAliveFailed += (_, error) => Console.WriteLine($"{error.Code} {error.Message}");Frames accumulate — each AddRays fills in more samples, so the image sharpens over time.
Validated against real captured frames: golden render tests pin the decode output to live-captured frame sequences from every device type (static CCTV, PTZ camera, auto-turret, drone). Refresh a fixture any time with the sample's headless capture mode (
RustPlus.Camera.ConsoleApp … capture <cameraId> <seconds> [outDir]).