Cordova: Playing media not saved on an SD card

In my Cordova app project, I have uploaded an MP3 audio file to my Android data directory "file: ///data/data/com.iappedyou.mobile/files/audio1.mp3".

When I now try to play this file through

function playMP3_3() {
   var mp3URL = cordova.file.dataDirectory + "audio1.mp3";
   var media = new Media(mp3URL, null, mediaError);
   media.play();
}

      

I am getting "Media error code: 1".

According to Simon's blog post, Android assumes that the file is stored on your "/ sdcard". But how can I play the audio file using dataDirectory?

thank

+3


source to share





All Articles