x***@tops001.com
x***@tops001.com
  • 发布:2016-05-29 17:40
  • 更新:2016-06-28 12:02
  • 阅读:12210

MUI如何调用拍照

分类:MUI

代码补充:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" name="viewport">
<meta content="yes" name="apple-mobile-web-app-capable">
<meta content="black" name="apple-mobile-web-app-status-bar-style">
<meta content="telephone=no" name="format-detection">
<meta content="email=no" name="format-detection">
<title>摄像</title>
<link rel="stylesheet" href="http://apps.bdimg.com/libs/bootstrap/3.3.4/css/bootstrap.min.css">
<link rel="stylesheet" href="http://apps.bdimg.com/libs/mui/2.8.0/css/mui.min.css">
<link rel="stylesheet" href="css/demoMUI.css">
</head>
<body>
<header class="mui-bar mui-bar-nav">
<a href="#" class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
<h1 class="mui-title">摄像</h1>
</header>

<div class="mui-content">
<button onclick="captureImage()">拍照</button>
</div>

<script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="http://apps.bdimg.com/libs/mui/2.8.0/js/mui.min.js"></script>
<script src="http://apps.bdimg.com/libs/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<script>
mui.init({
swipeBack: true //启用右滑关闭功能
});
// 扩展API加载完毕后调用onPlusReady回调函数
document.addEventListener( "plusready", onPlusReady, false );
// 扩展API加载完毕,现在可以正常调用扩展API
function onPlusReady() {
console.log("plusready");
}
// 拍照
function captureImage(){
var cmr = plus.camera.getCamera();
var res = cmr.supportedImageResolutions[0];
var fmt = cmr.supportedImageFormats[0];
console.log("Resolution: "+res+", Format: "+fmt);
cmr.captureImage( function( path ){
alert( "Capture image success: " + path );
},
function( error ) {
alert( "Capture image failed: " + error.message );
},
{resolution:res,format:fmt}
);
}

</script>
</body>
</html>
最近才开始找适合移动开发框架,看见MUI,遇见一些问题,希望大神讲解!!!!!
根据参照文档内容,plus is not defined。代码效果是怎样实现的?求大神讲解

2016-05-29 17:40 负责人:无 分享
已邀请:
小资电脑

小资电脑

开发注意要点:

1、真机运行,而不是PC浏览器运行。

2、与plus有关的一切代码 都注意是否已经 mui.plusready()

小飞牛

小飞牛

代码是没什么问题的,不过必须在真机或者在虚拟机运行,在浏览器运行会报plus is not defined

小资电脑

小资电脑

开发注意要点:

1、真机运行,而不是PC浏览器运行。

2、与plus有关的一切代码 都注意是否已经 mui.plusready()

增加第三项
3、手机APP里和服务器交互,严禁服务器使用127.0.0.1和localhost,除非你100%确定你的服务器程序是运行在你手机里的。你同一部手机即是客户端又是服务器,和其他任何网络、设备都没关系。

小天天

小天天

据说回贴会扣积分,我试试。。

  • x***@tops001.com (作者)

    这个扣不扣我就不知道了

    2016-06-06 11:21

  • DCloud_UNI_CHB

    回复 x***@tops001.com:积极回复网友问题只会增加积分,但若回复无意义的内容,被管理员审查折叠,就会扣除积分了

    2016-06-06 11:54

2***@qq.com

2***@qq.com - mui交流群239503027

castapp.js

学习真好

学习真好 - 野心

该问题目前已经被锁定, 无法添加新回复