The React-native-vision-camera is unable to connect to the rear-facing camera

Currently, I am facing a challenge using the 'normal' camera on my iPhone 11 Pro. I have implemented react-native-vision-camera in my project. When executing the following code:

const devices = useCameraDevices();
const deviceBack = devices.back;
console.log(deviceBack?.devices)

I am only seeing two cameras available:

["ultra-wide-angle-camera", "wide-angle-camera"]
. However, I specifically need access to my normal camera and not the wide angle one. How can I achieve this? Thanks.

Answer №1

In summary - Smartphone cameras typically have a wide-angle lens equivalent to around 22mm and 30mm. Therefore, opting for the wide-angle option is recommended as it is considered the "normal" type.


According to the react-native documentation, there are three identifiers for physical cameras on devices:

"ultra-wide-angle-camera"
| "wide-angle-camera" | "telephoto-camera"


"ultra-wide-angle-camera"
: A built-in camera with a shorter focal length compared to a wide-angle camera (focal length below 24mm).

"wide-angle-camera": A built-in wide-angle camera (focal length between 24mm and 35mm).

"telephoto-camera": A built-in camera with a longer focal length than a wide-angle camera (focal length above 85mm).


With that clarified, let's examine camera focal lengths equivalent to phone cameras' focal lengths (source)

Camera type Focal length Angle-of-view
Wide-angle 22mm to 30mm ~84° to ~62°
Telephoto 50mm to 80mm ~40° to ~25°
Ultrawide-angle 12mm to 18mm ~112° to ~90°
Periscope 103mm to 125mm ~20° to ~16°

The ideal "normal" focal length is considered to be 35mm, so selecting the wide-angle option is suggested since it closely aligns with this standard (and may even provide an angle of view closer to 35mm). Additionally, wide-angle lenses are commonly used in phone cameras.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Encountering CORS Issue when attempting to upload a file from an external URL using Angular

I am attempting to upload a file from an external URL, but I keep encountering a CORS error when trying to access the external URL. await fetch(url).then(function (res) { response = res; }).catch(function () { setTimeout(() => { this.toaster. ...

Tips on integrating library project into angular

I've been encountering a challenge with angular library projects lately. I'm trying to style a project using a global stylesheet while ensuring that the styles only affect the specific project itself. My attempted solution was to create a compone ...

Issue: The system needs the 'image' property to proceed (Dall E's image variation API by OpenAI)

Utilizing the Dall E Create image variation API has been a bit challenging for me. Every time I send a post request, I encounter this particular error: error: { "code": null, "message": "'image' is a required property&q ...

Display items in a not predetermined order

Despite its simplicity, I am struggling to get this working. My aim is to create a quiz program using JavaScript. Here is the basic structure: <ul> <li>option1</li> <li>option2</li> <li>option3</li> </ul> &l ...

How can we prevent checkbox and radio buttons from being triggered by accidental taps on the surrounding area on touch-responsive devices?

On touch screen responsive devices, there seems to be an issue where clicking outside the checkbox or radio button (within about 8px) causes the checkbox or radio button to toggle. This problem only occurs on responsive touch devices and works fine on desk ...

Is it possible to create a looped GLTF animation in three.js using random time intervals?

I am currently exploring the world of game development with Three.js and have a specific query regarding animating a GLTF model. Is it possible to animate the model at random intervals instead of in a continuous loop? In the game I am creating, players wil ...

The issue of req.file being consistently undefined in Node.js multer

I am having issues trying to upload a file using multer because the req.file is always undefined and the destination folder remains empty: Server: var express = require('express'); var multer = require('multer') var app = express(); ...

How to extract a substring from a string in Javascript

I am currently facing an issue with extracting a specific part of a string (from the URL pathname) and I need some help to solve it. Here is what I have tried so far: ^(/svc_2/pub/(.*?).php) The string in question is: /svc_2/pub/stats/dashboard.php?aja ...

Using jQuery, learn how to successfully call a selector from dynamic content

I am currently facing a challenge with a table that is generated server-side and then appended to the view page (client-side). Since the table is not directly included in the DOM, I am using the StickyTableHeaders jQuery plugin to create a sticky header fo ...

Switching hover behavior on dropdown menu for mobile and desktop devices

I have implemented a basic JavaScript function that dynamically changes HTML content based on the width of the browser window. When in mobile view, it removes the attribute data-hover, and when in desktop view, it adds the attribute back. The functionalit ...

Is there a more efficient method for implementing React OnChange for each field?

When calling an API, receiving a payload and loading it into state in React, we often encounter situations where we have multiple fields to update. This can lead to creating numerous onChange functions for each field. Is there a more efficient pattern tha ...

Ensure at least one checkbox is selected by using jQuery validation

I wrote the code below to select multiple checkboxes and validate that at least one checkbox is selected. The data submission to the database works if I remove onsubmit="return validate_form()". However, I want to ensure that at least one checkbox is selec ...

What is the best way to implement CSS modifications in a specific sequence?

There are times when I need to apply multiple CSS changes in a row, ensuring that each one is properly rendered. Check out this simple example The height of the element is set to auto, so transitioning is not possible. To work around this, I want to firs ...

Traversing a nested array in JavaScript to create a nested object in a loop

Struggling with translating a depth list into a nested object. Consider this list: "depth": [ 0, 1, 2, 3, 3, 2, 3, 3, 3 ], I'm trying to create a recursive function that generates an object like this: "depth": [ { "t ...

Check if a rotated rectangle lies within the circular boundary of the canvas

I have a rectangular shape that has been rotated using the ctx.rotate method, and there is also an arc on the canvas. My goal is to determine if any part of the rectangle lies within the boundaries of the arc. See the example below: https://i.sstatic.net/ ...

refreshing MySQL data without the need to reload the page

I am currently working on creating a universal "like button" that updates a MySQL table after being clicked without the need to reload the page. I believe this task can be achieved using JavaScript, although I am unsure of how to interact with MySQL usin ...

Converting an array of strings to integers using Highcharts and JavaScript

Trying to create a chart using highcharts involves getting data from a datatable in VB.NET, converting it into an array, then transforming it into JSON before passing it back to JavaScript for rendering. However, the data is not appearing on the chart, pos ...

Manipulate data destination using Javascript

I have a task in my AngularJS application that involves the following steps: 1) Click on a button. 2) If variableA is true, display a modal. 3) If variableA is false, redirect to another link without showing a modal. Here is the code I am using to ...

Bring in a project from Xcode 5 into SVN

I used to easily import projects in Xcode 4 using the "import" button in the organizer. How can I do this in Xcode 5 for projects located in my SVN repository? Thanks! ...

When using res.render to pass data to an EJS file and accessing it in plain JavaScript

I'm currently working on an Express GET function where I am sending data to an EJS file using the res.render() function. My question is, how can I access this data in plain JavaScript within the same EJS file? Here is my GET Function: router.get(&a ...