Phonegap Android 应用程序中的错误 VideoCapture
我正在尝试使用phonegap在android应用程序中捕获视频,但遇到问题
类型错误:表达式“navigator.device.capture.captureVideo”的结果[未定义]不是函数。
下面是我的代码
我在 head 中包含了以下内容
<script type="text/javascript" src="js/phonegap-1.2.0.js"></script>
<script src="js/jquery-1.6.4.min.js"></script>
<script type="text/javascript">
function recordVideo(){
var capture = navigator.device.capture;
var options1 = { limit: 1 };
navigator.device.capture.captureVideo(captureSuccess, captureError, options1);
alert("Record");
}
function captureSuccess(mediaFiles) {
var i, len;
for (i = 0, len = mediaFiles.length; i < len; i += 1) {
alert(mediaFiles[i].name);
}
}
function captureError(error) {
var msg = 'An error occurred during capture: ' + error.code;
alert(msg);
}
</script>
以及用于捕获按钮单击 Capture Video
但我在控制台上收到此错误
类型错误:表达式“navigator.device.capture.captureVideo”的结果[未定义]不是函数。
请帮我。
提前致谢。
蒂米尔
I am trying to capture video in android app using phonegap, but facing problem
TypeError: Result of expression 'navigator.device.capture.captureVideo' [undefined] is not a function.
Here bellow is my code
I included following in head
<script type="text/javascript" src="js/phonegap-1.2.0.js"></script>
<script src="js/jquery-1.6.4.min.js"></script>
<script type="text/javascript">
function recordVideo(){
var capture = navigator.device.capture;
var options1 = { limit: 1 };
navigator.device.capture.captureVideo(captureSuccess, captureError, options1);
alert("Record");
}
function captureSuccess(mediaFiles) {
var i, len;
for (i = 0, len = mediaFiles.length; i < len; i += 1) {
alert(mediaFiles[i].name);
}
}
function captureError(error) {
var msg = 'An error occurred during capture: ' + error.code;
alert(msg);
}
</script>
And code for capturing on a button click <a href="javascript:void(0);" onClick="recordVideo();">Capture Video</a>
But I getting this error on console
TypeError: Result of expression 'navigator.device.capture.captureVideo' [undefined] is not a function.
Please help me.
Thanks in advance.
Timir
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该添加所需的插件(https:// github.com/apache/cordova-plugin-media-capture/blob/master/doc/index.md)
如果您使用的是 intel xdk,请转到项目 ->;插件和权限
You should add the required plugin (https://github.com/apache/cordova-plugin-media-capture/blob/master/doc/index.md)
If you are using intel xdk go to project -> plugins and permissions