PhoneGap的捕获插件captureVideo不工作的PhoneGap 3.0.0-0.14.3 [英] phonegap capture plugin captureVideo not working phonegap 3.0.0-0.14.3

查看:155
本文介绍了PhoneGap的捕获插件captureVideo不工作的PhoneGap 3.0.0-0.14.3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经成功安装插件org.apache.cordova.core.media捕获。

I have plugin org.apache.cordova.core.media-capture installed successfully.

我做到了我的项目,

的PhoneGap本地插件添加 https://开头git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture.git

phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture.git

navigator.device.capture.captureVideo function does not respond to the call.

什么也没有发生在手机上。

Nothing happens on the phone.

如果我在前面,在调用它,第一个警报持久性有机污染物,但第二永远不会发生后面放警报。我希望未能进入captureError回调函数
并弹出一条消息,但仍然没有任何反应。

If I put an alert in front of and in back of the call to it, the first alert pops but the second never happens. I would expect a failure to go to the captureError callback function and pop up a message but still nothing happens.

/**
 *
 * captures the video 
 * A button will call this function
 * Launch device video recording application,
 * allowing user to capture 1 video clip
 */
function onCaptureVideo() {
  var options = { limit: 1 };
  alert('trying to capture');
  // start image capture
  navigator.device.capture.captureVideo(captureSuccess, captureError, options);
}

另外,回调函数

/**
 * Called when capture operation is finished
 * @param mediaFiles
 */
  var captureSuccess = function(mediaFiles) {
  var i, path, len;
  for (i = 0, len = mediaFiles.length; i < len; i += 1) {
    path = mediaFiles[i].fullPath;
    // do something interesting with the file
  }
};

/** 
 *
 * Called if something bad happens.
 * @param error
 */
var captureError = function(error) {
  navigator.notification.alert('Error code: ' + error.code, null, 'Capture Error');
};

这需要工作,所以我可以捕获在Android和iOS的视频和图片,并上传到服务器。

This needs to work so I can capture videos and pictures on android and IOS, and then upload them to the server.

目前,我在Android三星Galaxy S4测试此

Currently I am testing this on an Android Samsung Galaxy S4

任何人有关于如何获取视频采集工作的任何想法呢?

Anyone have any ideas on how to get the video capture working?

推荐答案

的问题是,无论出于何种原因的PhoneGap 3.0变得有点出问题似乎并没有想新的插件的应用程序添加到android.json文件/ plugins文件夹,然后不包括在app /平台/安卓/资产/ WWW / plugins文件夹中的插件,当它建立,然后也没有添加一些插件文件应用/平台/ Android系统/ src目录/组织/阿帕奇/科尔多瓦/ {插件文件夹名称}文件夹。在这种情况下,mediacapture

The problem was that for whatever reason phonegap 3.0 gets a little glitchy and does not seem to want to add new plugins to the android.json file in the app/plugins folder and then does not include the plugins in the app/platforms/android/assets/www/plugins folder when it builds and then also does not add some of the plugins files to app/platforms/android/src/org/apache/cordova/{plugin folder name} folder. in this case "mediacapture".

我曾尝试添加插件文件中手动应用/平台/安卓/资产/ WWW /插件,但没有被正确地添加插件到App /插件/ android.json。它只是删除它们,并且不使用它们下次你建立的时间。

I had tried adding plugin files manually to app/platforms/android/assets/www/plugins but without the plugin being properly added to app/plugins/android.json. It just deletes them and does not use them next time you build.

除非你是一个专家,android.json真的需要通过PhoneGap的工作要做。

Unless your are an expert, android.json really needs to be done by phonegap.

因此​​,我所要做的就是,备份我的应用程序/平台/安卓/ src目录/组织/阿帕奇/科尔多瓦/文件夹
并且还应用/平台/安卓/资产/ WWW / plugins文件夹中。

So what I had to do was, backup my app/platforms/android/src/org/apache/cordova/ folder And also app/platforms/android/assets/www/plugins folder.

然后我提出我的项目文件夹,在它的全部关到另一个位置作为一个坚定的备份,拉着我的项目源低于git的枢纽和重建整个项目,像这样..我也必须给予信贷亚当韦德哈里斯,你会找到他就到这里,也与PhoneGap的问题和答案,他给了我这个脚本的一部分。

Then I moved my project folder in it's entirety off to another location as a firm backup and pulled my project source down from git hub and rebuilt the entire project like so.. Also I must give credit to Adam Wade Harris, you will find him on here, also with phonegap questions and answers and he gave me part of this script.

把你的真实项目,并在这里反向域名和应用程序名称

Put in your real project and reverse domain here and app name

phonegap create {newAppFolderName} com.somedomain.prefix AppShortName
cd newAppFolderName
phonegap build android

设置混帐用假分支

setup git with a fake branch

git init

把你的实际项目回购此处

put in your real project repo here

git remote add origin git@bitbucket.org:someorganization/yourrepo.git
git fetch origin
git checkout -b nothingBranch
git add .
git commit -m "nothing"

结帐你真正在这里支

Checkout your real branch here

git checkout -b master origin/master
git branch --set-upstream-to=origin/master master

在您的项目中创建文件夹的平台。

create the platforms folder in your project

mkdir /path/to/newAppFolderName/platforms/

为你做这个有可能像这样每个插件

Do this for each plugin you might have like so

phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git
phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information.git

phonegap build android

这可能不是每个人都工作,请确保您保留原始的项目关闭的地方和最好的希望,复制结束了缺少任何插件文件,即使有一个干净的重建,PhoneGap的似乎离开了几个文件夹和我不得不把他们在的地方再次手动。

This may not work for everyone, make sure you keep your original project off somewhere and hope for the best, copy any plugin files that ended up being missing, even with a clean rebuild, phonegap seemed to leave out several folders and I had to put them in place again manually.

这篇关于PhoneGap的捕获插件captureVideo不工作的PhoneGap 3.0.0-0.14.3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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