是否可以在应用程序(使用 phonegap 构建)中打开相机 View ? 我做了一些研究,发现 phonegap 相机插件使用 intents,而我需要做的是使用 android 设备提供的相机 API。我知道我需要对插件进行大量调整,或者创建我自己的插件。我只想知道是否可能
如果可以的话,我会发布进一步的问题
提前致谢:)
最佳答案
如果分辨率是您需要用户配置的全部,这里是 Cordova + Regular Camera 插件解决方案的尝试。显然,您会希望构建比使用内置 Javascript 提示更好看的东西,但这给了您想法。一旦成功,您就可以换掉您自己的自定义 UI 表单的提示以获取解析参数。
function takePictureWithUsersSelectedResolution()
{
var userSelectedQuality = prompt("Please enter the picture quality");
var userSelectedWidth = prompt("Please enter the picture width");
var userSelectedHeight = prompt("Please enter the picture height");
navigator.camera.getPicture
(
function onSuccess(imageData)
{
// save the pic or do something else with it
yourSaveFunction(imageData);
},
function onFail(message)
{
// do something with the error
yourErrorLoggingFunction(message);
},
{
// *** Main Settings You Need to Customize ***
quality : userSelectedQuality,
targetWidth: userSelectedWidth,
targetHeight: userSelectedHeight
}
);
}
有关可以发送到相机插件的设置的更多信息,请参阅文档: http://docs.phonegap.com/en/3.3.0/cordova_camera_camera.md.html
关于android-intent - 调整 phonegap 相机插件以在应用程序中显示 'camera view',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23466013/