문제

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