V/Capacitor/Plugin: To native (Cordova plugin): callbackId: Capture1685955499, service: Capture, action: captureAudio, actionArgs: [{"limit":3000}]
D/Capacitor: App paused
D/Capacitor: Unable to find a Capacitor plugin to handle requestCode, trying Cordova plugins 1
Getting error that it can not find the plugin
Used npm to install all the plugins
it shows as installed in package.json
That means Capacitor didn’t find a Capacitor plugin to handle the request code, so will try with Cordova plugins, which is expected as you say it’s a Cordova plugin.
Inside of an Ionic Vue project, How would one access a cordova plugin over a Capacitor plugin?
import { MediaCapture, CaptureAudioOptions } from "@ionic-native/media-capture";
....
const captureAudio = async () =>{
try {
let fileName =
'record' +
new Date().getDate() +
new Date().getMonth() +
new Date().getFullYear() +
new Date().getHours() +
new Date().getMinutes() +
new Date().getSeconds();
if (isPlatform('ios')) {
fileName = fileName + '.m4a';
audioPath = FilesystemDirectory.Documents+ fileName;
} else if (isPlatform('android')) {
fileName = fileName + '.mp3';
audioPath = FilesystemDirectory.Documents + fileName;
}
const opts: CaptureAudioOptions = {
limit: 3000,
}
const audio = await MediaCapture.captureAudio(opts);
audioPath.replace(/file:\/\//g, '')
recordingState.value = true;
} catch (error) {
console.log(error);
}
}