SpawnDev.MultiMedia

Cross-platform camera, microphone, speaker and screen capture for .NET.

License: MITnet10.0

SpawnDev.MultiMedia is a cross-platform media capture and playback library with a browser-style MediaDevices API: camera, microphone, speakers and screen capture. Browser (Blazor WASM) and Windows are feature-complete; Linux has device enumeration only and macOS is planned. It has no external media NuGet dependencies on desktop.

Runs on

Blazor WebAssembly (browser)WindowsLinux (device enumeration only)macOS (planned)

Highlights

  • getUserMedia-style API: MediaDevices.GetUserMedia and EnumerateDevices, same code on browser and desktop.
  • Camera and microphone capture with resolution, frame-rate, sample-rate and channel constraints; virtual cameras (OBS, ManyCam) supported.
  • Screen capture: browser getDisplayMedia and DXGI Desktop Duplication on Windows.
  • Pixel format conversion (NV12, I420, YUY2, BGRA, RGB24, UYVY) on CPU and on ILGPU GPU paths; MJPG decode with GPU dequantize + IDCT + color convert.
  • H.264 encoding on Windows through the MediaFoundation encoder (hardware accelerated where available).
  • Feeds SpawnDev.RTC: desktop microphone and camera tracks can be added to a peer connection for live calls with browser peers.
Program.cs
using SpawnDev.MultiMedia;

// Get camera + mic - same code on browser, Windows, Linux (enumeration), future macOS
var stream = await MediaDevices.GetUserMedia(new MediaStreamConstraints
{
    Video = true,
    Audio = true
});

var videoTrack = stream.GetVideoTracks()[0];
var settings = videoTrack.GetSettings();
Console.WriteLine($"Camera: {settings.Width}x{settings.Height} @ {settings.FrameRate}fps");

// List available devices
var devices = await MediaDevices.EnumerateDevices();
foreach (var device in devices)
    Console.WriteLine($"[{device.Kind}] {device.Label}");

Install

dotnet add package SpawnDev.MultiMedia

Building on SpawnDev.MultiMedia?

Private tickets, response targets and a direct line to the engineer who wrote it.

See support plans
An unhandled error has occurred. Reload x