Search docs/
Getting StartedPlugins


This plugin provides the ability to record and play back audio files on a device.

Premier Version Available

Featuring regular release cycles, security and bug fixes, and guaranteed SLAs.

Available here


ionic cordova plugin add cordova-plugin-medianpm install @ionic-native/medianpm install cordova-plugin-medianpm install @ionic-native/mediaionic cap sync
Ionic Native Enterprise はIonic Teamが完全にサポートしメンテナンスしているプラグインを利用できます。 詳しくみる か、エンタープライズプラグインに興味があれば 連絡ください


  • Android
  • Browser
  • iOS
  • Windows


Using React?

See here.

import { Media, MediaObject } from '@ionic-native/media/ngx';

constructor(private media: Media) { }


// Create a Media instance.  Expects path to file or url as argument
// We can optionally pass a second argument to track the status of the media

const file: MediaObject ='file.mp3');

// to listen to plugin events:

file.onStatusUpdate.subscribe(status => console.log(status)); // fires when file status changes

file.onSuccess.subscribe(() => console.log('Action is successful'));

file.onError.subscribe(error => console.log('Error!', error));

// play the file;

// pause the file

// get current playback position
file.getCurrentPosition().then((position) => {

// get file duration
let duration = file.getDuration();

// skip to 10 seconds (expects int value in ms)

// stop playing the file

// release the native audio resource
// Platform Quirks:
// iOS simply create a new instance and the old one will be overwritten
// Android you must call release() to destroy instances of media when you are done

// Recording to a file
const file: MediaObject ='path/to/file.mp3');



Some hints if you are using iOS and recording doesn't work: 1.) Try to use a absolute file path but remove beginning "file://". Then it looks like: /var/mobile/Containers/Data/Application/AF438B8B-7724-4FBB-8E69-083463224FC4/tmp/my_file.m4a Example:^file:\/\//, '') + 'my_file.m4a') 2.) If that's not working, too, create the file before using. Example:

import { Media, MediaObject } from '@ionic-native/media/ngx';
import { File } from '@ionic-native/file/ngx';


constructor(private media: Media, private file: File) { }


this.file.createFile(this.file.tempDirectory, 'my_file.m4a', true).then(() => {
  let file =^file:\/\//, '') + 'my_file.m4a');
  window.setTimeout(() => file.stopRecord(), 10000);

You can find the reasons here: