在android中的html中显示相机视图,然后拍照 [英] Showing camera view inside html in android and then snap a picture

查看:50
本文介绍了在android中的html中显示相机视图,然后拍照的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们使用 JavaScript 拍摄图片之前,是否有在 html 中显示实时相机视图的视图(例如嵌入到 div 中)?我尝试过 PhoneGap,但它完全启动了一个新的相机应用程序,并在返回之前完全远离我的 html web 应用程序.我需要在我的应用中嵌入一些东西

谢谢

解决方案

您可以安装 mbppower/CordovaCameraPreview 插件(适用于 android、ios) 在您的 Cordova/phonegap 应用程序中,允许从 HTML 代码进行相机交互.一个非常了不起的插件它是..您可以访问以下功能:

从 HTML 代码开始相机预览.拖动预览框.设置相机颜色效果(Android和iOS),将预览框发送到HTML内容的后面,为相机预览框设置自定义位置,为预览框设置自定义大小并保持HTML交互性.>

或者您也可以为您的应用程序使用 donaldp24/CanvasCamera 插件如果它符合您的要求.它在 android 和 iOS 平台上都受支持.我观察到,对于 iOS,它运行良好,但在 android 中它不起作用.

现在您也可以通过 Online PhoneGap 安装 CordovaCameraPreview 插件.因此,无需使用 CLI,您可以通过添加

直接使用它

<gap:plugin name="com.mbppower.camerapreview" version="0.0.8" source="plugins.cordova.io"/>

在您的 config.xml 文件中并创建 ApplicationTemplate.apk/.ipa.有关这方面的更多信息,您可以问我.乐于帮助.

更新:2017 年 10 月 10 日在那段时间它曾经运行良好,但是,donaldp24/CanvasCamera 不再维护,并且当前无法使用最新的 Cordova 版本构建.

Is there a view of showing the live camera view inside html ( e.g. embedded in a div ) before we snap a picture using JavaScript? I have tried PhoneGap but it totally starts a new camera app and totally moves away from my html web app before returning to it. I need something embedded in my app

Thanks

解决方案

You can install mbppower/CordovaCameraPreview plugin (for android,ios) in your Cordova/phonegap application that allows camera interaction from HTML code. A really amazing plugin it is.. You can access Features such as:

Start a camera preview from HTML code. Drag the preview box. Set camera color effect (Android and iOS),Send the preview box to back of the HTML content,Set a custom position for the camera preview box,Set a custom size for the preview box and Maintain HTML interactivity.

Or you can also use donaldp24/CanvasCamera Plugin for your application if it fits to your requirements.Its supported in both android and iOS platforms. I have observed, for iOS its working fine but in android it isn't working.

Now you can install CordovaCameraPreview plugin through Online PhoneGap too. So without using CLI you can directly use it through this by adding

<gap:plugin name="com.mbppower.camerapreview" version="0.0.8" source="plugins.cordova.io" />

in your config.xml file and create ApplicationTemplate.apk/.ipa. For more information regarding this you can ask me. Happy to help.

UPDATE:10th Oct 2017 It used to work well during that time but, donaldp24/CanvasCamera is no longer maintained and currently fails build with the latest Cordova version.

这篇关于在android中的html中显示相机视图,然后拍照的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆