Вопрос

I am having problem playing sound in Icenium Cordova 3.2 project on my iPhone 5S. I am using the following code:

 if (device.platform == "Android") {
        src = new Media("/android_asset/www/audio/multimedia.mp3");
    } else {
          src = new Media("audio/multimedia.mp3"); // this line runs on my device
    } 

  src.play();

The audio file multimedia.mp3 exists in a folder called audio under the main project folder. I've tried different paths like /audio/multimedia.mp3 and multimedia.mp3 and the sound is not playing on my device.

When I use an absolute path to an external URL (http://somesite.com/audiofile.mp3) the audio file plays on my device. I haven't tested the code in Android yet. Thanks.

Это было полезно?

Решение

I think you have miss to add phonegap.js plugin.So your FileReader is not working or may be forget to add file plugin.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top