Media Capture

Contents

This plugin provides access to the device's audio, image, and video capture capabilities.

https://github.com/apache/cordova-plugin-media-capture

Ionic 媒体 Media Capture插件的安装(Installation)

ionic cordova plugin add cordova-plugin-media-capture npm install @ionic-native/media-capture

Ionic 媒体 Media Capture插件支持的平台(Supported Platforms)

  • Android
  • Browser
  • iOS
  • Windows

Ionic 媒体 Media Capture插件的用法(Usage)

import { MediaCapture, MediaFile, CaptureError, CaptureImageOptions } from '@ionic-native/media-capture';


constructor(private mediaCapture: MediaCapture) { }

...


let options: CaptureImageOptions = { limit: 3 };
this.mediaCapture.captureImage(options)
  .then(
    (data: MediaFile[]) => console.log(data),
    (err: CaptureError) => console.error(err)
  );