Hello ionites !
I am struggling to play audio on windows phone (universal) with ionic 2.
This is my code :
playAudio (audioFileName){
let path = audioFileName;
if (this.platform.is(‘android’)) {
//works fine on android
path = “/android_asset/www/” + path ;
} else if (this.platform.is(‘windows’)) {
//does NOT work on windows phone universal
path = “ms-appdata:///local/” + path ;
}
var file = new MediaPlugin(path);
file.play();
}
I have added line
<preference name="windows-target-version" value="10.0"/>
to my config.xml,
app launch fine , all images are displayed correctly but I hear not audio when I call this method using the Media player plugin.
This code works fine for android, I can hear the sound but no sound on windows phone (10)
Please help.