Skip to content

Instantly share code, notes, and snippets.

@olokobayusuf
Created October 20, 2021 13:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save olokobayusuf/24f2f9639d72a614fb02c0de4650d30c to your computer and use it in GitHub Desktop.
Save olokobayusuf/24f2f9639d72a614fb02c0de4650d30c to your computer and use it in GitHub Desktop.
// Create a device query to discover the rear camera
var query = new MediaDeviceQuery(MediaDeviceCriteria.RearCamera);
// Get the rear camera
var device = query.current as CameraDevice;
// Create a texture output to convert pixel buffers to textures
var textureOutput = new TextureOutput();
// Start the camera preview
device.StartRunning(textureOutput);
// Get the preview texture from the texture output
Texture2D previewTexture = await textureOutput;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment