Getting error No provider for MediaPlugin

here’s my code

import {Page, NavController, NavParams} from 'ionic-angular';
import {TesouroDataService} from '../../providers/tesouro-data-service/tesouro-data-service';
import {Post} from '../../providers/tesouro-data-service/tesouro-data-service';
import {MediaPlugin} from 'ionic-native';

  templateUrl: 'build/pages/item-detail/item-detail.html',
export class ItemDetailPage {

  post: any;
  playing = false;

  hasAudio = false;

  constructor(private nav: NavController, navParams: NavParams, private mp:MediaPlugin) { = navParams.get('item');
    if ( != '') {
      this.hasAudio = true;
    } else {
    this.hasAudio = false;

  this.playing = true;

  this.playing = false;;


I have the exact same issue, did you solve it?

Angular has changed quite a bit since this topic was originally posted, so can you share some code?

Anybody resolve this issue?

Did you read the previous comment?

1 Like

That is the documentation for Media Plugin.

Usually you add ionic native plugins like that:
add the plugin to your app with cli command
ionic plugin add --save PLUGINNAME

install the ionic native plugin from npm
npm install --save @ionic-native/PLUGINNAME

import it in your page/provider and in your app.module.ts
import { PLUGINNAME } from '@ionic-native/PLUGINNAME';

add it to your app.module.ts
providers: [ PLUGINNAME ]

use DI in your constructor in your page/provider
constructor(private pluginName: PLUGINNAME) { }

then you can use it in your code