简体   繁体   English

Dart语言和Android:访问手机的摄像头

[英]Dart Language and Android: accessing phone's camera

I'm starting a project to develop a mobile application where I'll need to access the phone's camera and retrieve a picture/photo. 我正在启动一个开发移动应用程序的项目,在该应用程序中,我需要访问手机的摄像头并检索图片/照片。

However, before going to a native application, I would like to know if Dart (compiled to JavaScript, of course) could access Android phone's camera and retrieve that picture. 但是,在进入本机应用程序之前,我想知道Dart(当然是编译为JavaScript)是否可以访问Android手机的摄像头并检索该图片。 In that case, the application would be web based. 在这种情况下,该应用程序将基于Web。

Could Dart do it or I'll need a native application? Dart可以做到吗?还是我需要一个本机应用程序?

(It's more depending on the browser than on the language...) (更多取决于浏览器而不是语言...)

There is a dedicated html input tag for this since android 3.0 but i dunno if you can easily access it from dart or if it's enough for you..? 自android 3.0起有一个专用的html输入标签,但是我不知道您是否可以从dart轻松访问它,或者它是否对您足够。

There is also the more conventionnal Html5 mediastream (that should fit all your needs) but it wont work below android 4.4 ... 还有更常规的Html5 mediastream (应该适合您的所有需求), 但在android 4.4以下无法正常工作 ...

Yes you can access the camera. 是的,您可以访问相机。

window.navigator.getUserMedia(audio: false, video: true)
.then((MediaStream stream) {
  // Stuff happens here
});

Also I've been looking at the Rikulo Gap package and it seems to be able to access the camera as well as other mobile sensors. 另外,我一直在看Rikulo Gap软件包,它似乎能够访问相机以及其他移动传感器。

https://github.com/rikulo/gap https://github.com/rikulo/gap

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

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