When I call native events like taking a photo, recording an audio or video on an IOS build, the app closes automatically. But it’s working on Android and browsers including Safari.
I am using following stack in the package.json:
"@ionic/react": "^6.0.4",
"@capacitor/core": "^3.4.1",
"@awesome-cordova-plugins/core": "^5.39.1",
"@awesome-cordova-plugins/media-capture": "^5.39.1",
"@awesome-cordova-plugins/native-audio": "^5.39.1",
Here are the imported files:
import { Capacitor } from "@capacitor/core";
import { MediaCapture, MediaFile, CaptureAudioOptions, CaptureVideoOptions, CaptureError } from '@awesome-cordova-plugins/media-capture';
import { File, DirectoryEntry } from "@ionic-native/file";
Here is the sample code I’ve used
let capturedFile: any;
let options: CaptureVideoOptions = { limit: 1, duration: 30 };
await MediaCapture.captureVideo(options).then(
(data: MediaFile[]) => {
console.log(data);
capturedFile = data[0];
},
(err: CaptureError) => {
console.error(err);
}
);
console.log(capturedFile);