How do you load and use the Media plugin in Ionic 2


#1

I’m trying to use the cordova media plugin in Ionic 2 but can’t figure out how to do it.

I’ve tried every form of import {…} from ‘…’ I can think of nothing.

I’ve tried to include it by just using globals like: $Media, $cordovaMedia $window.Media etc.

I dug through the ionic-native package, but found nothing.

What am I doing wrong?

From the command line, I’ve done this:
ionic plugin add org.apache.cordova.media

How do I make this thing load so I can call something like this:
let media = new Media(‘blah.mp3’);
media.play();


#2

Bump. I have the same question. Trying to use the Media plugin but no idea how to import it. Anyone?


#3

the same problem for me! I just would like to play a sound in ionic2.


#5

This foruim dead? Still no answer :frowning:


#6

see on my chifoumi(Rock, paper, scissors) I play a soon with ionic2 when you win https://github.com/prolland006/chifoumi