简体   繁体   English

React Native-使用CameraRoll Api是否可以访问相机?

[英]React Native - Is this possible to access the camera by using the CameraRoll Api?

I am working on my app project which also deals with the camera, photos & videos. 我正在做我的应用程序项目,该项目还处理相机,照片和视频。 I want to use the standard APIs not third party developers APIs, by standard APIs i mean those APIs which are documented on the react native official website . 我想使用标准API,而不是第三方开发人员API,通过标准API,我指的是在React Native官方网站上记录的那些API。

I found CameraRoll API in the documentation and my question is whether it is possible to achieve the following using this API? 我在文档中找到了CameraRoll API,我的问题是使用该API是否可以实现以下目标?

  • Access Photos & Videos 访问照片和视频
  • Select Photos & Videos 选择照片和视频
  • Open camera and take Photos & Record Videos 打开相机并拍摄照片和录制视频

I am sure about the first two that we can achieve, but doubtful about the third. 我对我们可以实现的前两个有把握,但对第三个有疑问。 Can anyone tell that can we achieve the third by using CameraRoll API? 谁能说出我们可以通过使用CameraRoll API来达到第三个目标吗?

  • Yes
  • No 没有
  • No 没有

The documentation clearly says what the API can and can't do. 该文档明确说明了API可以做什么和不能做什么。 getPhoto() will only return a promise containing an array with image information, no actual images. getPhoto()将仅返回包含图像信息数组的promise,没有实际图像。 You'd have to implement a custom viewer. 您必须实现一个自定义查看器。 And it can't access the camera, only stored files. 而且它无法访问相机,只能访问存储的文件。

If that's what you want to do react-native-image-picker is your best friend. 如果那是您想做的事情,那么react-native-image-picker是您最好的朋友。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM