NatDevice
Search…
NatDevice
Cross-Platform Media Device API for Unity Engine

Media Devices Made Easy

NatDevice is a cross-platform media device API. NatDevice simplifies your camera and microphone workflows.
First, find an available device:
Camera
Microphone
1
// Create a device query for a camera device
2
var criterion = MediaDeviceCriteria.CameraDevice;
3
var query = new MediaDeviceQuery(criterion);
4
// Get the camera device
5
var device = query.current as CameraDevice;
Copied!
1
// Create a device query for a microphone device
2
var criterion = MediaDeviceCriteria.AudioDevice;
3
var query = new MediaDeviceQuery(criterion);
4
// Get the microphone device
5
var device = query.current as AudioDevice;
Copied!
Then start streaming media data from the device:
Camera
Microphone
1
// Start streaming the camera preview to a texture
2
Texture2D previewTexture = await device.StartRunning();
Copied!
1
// Start streaming audio sample buffers
2
device.StartRunning(OnSampleBuffer);
3
// The device will stream audio to the delegate below
4
void OnSampleBuffer (float[] sampleBuffer, long timestamp) { ... }
Copied!
From here, you can utilize tons of functionality provided by media devices to build your interactive applications.

Extensive and Lightweight

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, exposure, white balance, torch, zoom, and orientation support.
  • Support for microphones with echo cancellation for karaoke and voice call apps.
  • Integration with OpenCV, for using computer vision algorithms with the camera.
  • VR support, compatible with GearVR and Google Cardboard.
Make sure to explore the full documentation to get a complete understanding of what the API offers.

Get NatDevice

NatDevice - Media Device API
UnityAssetStore
NatDevice on the Unity Asset Store
Last modified 6mo ago