Android phonegap捕获插件captureVideo不工作phonegap 3.0.0-0.14.3
我已成功安装插件org.apache.cordova.core.media-capture 我在我的项目中与 phonegap本地插件添加 电话里什么也没发生 如果我在呼叫的前后都发出警报,第一个警报会弹出,但第二个警报永远不会发生。我希望转到captureError回调函数会失败 然后弹出一条消息,但还是什么都没发生Android phonegap捕获插件captureVideo不工作phonegap 3.0.0-0.14.3,android,plugins,phonegap-plugins,video-capture,galaxy,Android,Plugins,Phonegap Plugins,Video Capture,Galaxy,我已成功安装插件org.apache.cordova.core.media-capture 我在我的项目中与 phonegap本地插件添加 电话里什么也没发生 如果我在呼叫的前后都发出警报,第一个警报会弹出,但第二个警报永远不会发生。我希望转到captureError回调函数会失败 然后弹出一条消息,但还是什么都没发生 /** * * captures the video * A button will call this function * Launch device video
/**
*
* 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');
};
/**
*捕获操作完成时调用
*@param媒体文件
*/
var capturesccess=函数(媒体文件){
变量i,路径,len;
对于(i=0,len=mediaFiles.length;i
这需要工作,以便我可以在android和IOS上捕获视频和图片,然后将它们上传到服务器
目前,我正在Android三星Galaxy S4上测试这一功能
有人对如何让视频捕获工作有什么想法吗 问题在于,无论出于何种原因,phonegap 3.0出现了一些问题,似乎不想在app/plugins文件夹中的android.json文件中添加新插件,然后在构建时不将插件包含在app/platforms/android/assets/www/plugins文件夹中,然后也不将一些插件文件添加到app/platforms/android/assets/www/plugins文件夹中app/platforms/android/src/org/apache/cordova/{plugin folder name}文件夹。在本例中为“mediacapture” 我曾尝试将插件文件手动添加到app/platforms/android/assets/www/plugins,但没有将插件正确添加到app/plugins/android.json。它只是删除它们,下次构建时不会使用它们 除非您是专家,否则android.json确实需要由phonegap完成 所以我要做的就是备份我的app/platforms/android/src/org/apache/cordova/folder 还有app/platforms/android/assets/www/plugins文件夹 然后,我将整个项目文件夹移动到另一个位置作为固定备份,并从git hub中取出项目源代码,然后像这样重建整个项目。。我还要感谢亚当·韦德·哈里斯,你会在这里找到他,还有电话缺口问题和答案,他给了我这个剧本的一部分 把你真正的项目和反向域名在这里和应用程序名称
phonegap create {newAppFolderName} com.somedomain.prefix AppShortName
cd newAppFolderName
phonegap build android
用假分支安装git
git init
把你真正的项目回购放在这里
git remote add origin git@bitbucket.org:someorganization/yourrepo.git
git fetch origin
git checkout -b nothingBranch
git add .
git commit -m "nothing"
在这里签出您真正的分支
git checkout -b master origin/master
git branch --set-upstream-to=origin/master master
在项目中创建平台文件夹
mkdir /path/to/newAppFolderName/platforms/
对你可能喜欢的每个插件都这样做
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似乎遗漏了几个文件夹,我不得不手动将它们重新放置到位
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