Comment on page
NatDevice
High Performance, Cross-Platform Media Device Streaming for Unity Engine
NatDevice is a cross-platform media device API. NatDevice simplifies your camera and microphone workflows. First, discover a media device:
Camera
Microphone
// Create a device query for a camera device
var filter = MediaDeviceCriteria.CameraDevice;
var query = new MediaDeviceQuery(filter);
// Get the camera device
var device = query.current as CameraDevice;
// Create a device query for a microphone device
var filter = MediaDeviceCriteria.AudioDevice;
var query = new MediaDeviceQuery(filter);
// Get the microphone device
var device = query.current as AudioDevice;
Then start streaming media data from the device:
Camera
Microphone
// Start streaming camera images
device.StartRunning(OnCameraImage);
void OnCameraImage (CameraImage cameraImage) {
// Do stuff
...
}
// Start streaming audio sample buffers
device.StartRunning(OnAudioBuffer);
void OnAudioBuffer (AudioBuffer audioBuffer) {
// Do stuff
...
}
From here, you can utilize tons of functionality provided by media devices to build your interactive applications.
NatDevice is a lightweight API that provides extensive functionality for using media devices. Features include:
- Stream the camera preview and microphone audio with very little latency.
- Support for high resolution camera previews, at full HD and higher where supported.
- Support for specifying microphone sample rate and channel count.
- Extensive camera control including hi-res photo capture, flash, focus, manual exposure, white balance, torch, zoom, and orientation support.
- Extensive metadata including exposure bias, exposure duration, ISO, focal length, and so on.
- Support for microphones with echo cancellation for karaoke and voice call apps.
- Integration with NatML, for low-latency, high-performance machine learning on the camera preview or microphone stream.
Make sure to explore the full documentation to get a complete understanding of what the API offers.

GitHub - natmlx/NatDevice: High performance, cross-platform camera and microphone streaming for Unity Engine. Register at https://hub.natml.ai
GitHub
Make sure to star NatDevice on GitHub!
Last modified 1yr ago