Skip to main content

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?

Don't waste precious time on plugin issues.

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#

$ npm install cordova-plugin-media-capture
$ npm install @ionic-native/media-capture
$ ionic cap sync

Supported Platforms#

  • Android
  • Browser
  • iOS
  • Windows

Usage#

React#

Learn more about using Ionic Native components in React

Angular#

import { MediaCapture, MediaFile, CaptureError, CaptureImageOptions } from '@ionic-native/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)
);