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.
我认为您错过了添加phonegap.js
插件的phonegap.js
因此您的FileReader无法正常工作或可能会忘记添加文件插件。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.