Media Capture
This plugin provides access to the device's audio, image, and video capture capabilities.
Requires Cordova plugin: cordova-plugin-media-capture
. For more info, please see the Media Capture plugin docs.
https://github.com/apache/cordova-plugin-media-capture
Stuck on a Cordova issue?
If you're building a serious project, you can't afford to spend hours troubleshooting. Ionic’s experts offer premium advisory services for both community plugins and premier plugins.
Installation
- Capacitor
- Cordova
- Enterprise
$ npm install cordova-plugin-media-capture
$ npm install @awesome-cordova-plugins/media-capture
$ ionic cap sync
$ ionic cordova plugin add cordova-plugin-media-capture
$ npm install @awesome-cordova-plugins/media-capture
Ionic Enterprise comes with fully supported and maintained plugins from the Ionic Team. Learn More or if you're interested in an enterprise version of this plugin Contact Us
Supported Platforms
- Android
- Browser
- iOS
- Windows
Usage
React
Learn more about using Ionic Native components in React
Angular
import { MediaCapture, MediaFile, CaptureError, CaptureImageOptions } from '@awesome-cordova-plugins/media-capture/ngx';
constructor(private mediaCapture: MediaCapture) { }
...
let options: CaptureImageOptions = { limit: 3 }
this.mediaCapture.captureImage(options)
.then(
(data: MediaFile[]) => console.log(data),
(err: CaptureError) => console.error(err)
);