Javascript TypeError:无法读取属性';捕获';未定义的
我正在使用cordova Media Capture插件,但不可能让它正常工作,我无法解决它 错误:Javascript TypeError:无法读取属性';捕获';未定义的,javascript,cordova,ionic-framework,Javascript,Cordova,Ionic Framework,我正在使用cordova Media Capture插件,但不可能让它正常工作,我无法解决它 错误:TypeError:无法读取未定义的属性“捕获” 这是我在Ionic应用程序中使用的控制器,到目前为止似乎没有任何效果。有什么想法吗 .controller('recordController', ['$scope', '$timeout', '$state', '$document', '$firebaseArray', 'CONFIG', function($scope, $timeout,
TypeError:无法读取未定义的属性“捕获”
这是我在Ionic应用程序中使用的控制器,到目前为止似乎没有任何效果。有什么想法吗
.controller('recordController', ['$scope', '$timeout', '$state', '$document', '$firebaseArray', 'CONFIG', function($scope, $timeout, $state, $document, $firebaseArray, CONFIG) {
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
console.log(navigator.device.capture);
}
var captureSuccess = function(e) {
console.log('captureSuccess');console.dir(e);
$scope.sound.file = e[0].localURL;
$scope.sound.filePath = e[0].fullPath;
}
$scope.recordAudio = function() {
navigator.device.capture.captureAudio(
captureSuccess,captureError,{duration:10});
}
var a = document.getElementById('tags');
a.addEventListener('keyup',addthis);
function addthis() {
b = a.value.replace('#','');
a.value = '#'+b
if (a.value.indexOf(' '))
{
a.value = a.value.replace(' ','#');
}
}
}])
尝试安装设备插件
cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git
尝试只记录navigator.device并查看它是什么。您好,它没有显示任何内容,控制台中根本没有显示任何内容…捕获对象需要存在于navigator.device对象上。如果它不存在,那么您应该得到当前的异常,这表明捕获插件可能没有安装在您的项目上?安装它使用:cordova插件添加cordova插件媒体捕获(访问repo)是的,我遵循了一切,它是安装的,甚至当我在Android上构建时,安装时它显示录音机正在请求许可。。。它只是系统地触发这个错误,不管我怎么定义。而DeviceRady的监听器从不启动,我不知道为什么…也许,在addListener之前定义DeviceRady