简体   繁体   中英

Android Cordova Media API not playing local media file

I am using Intel XDK + Cordova Media API to play a sound.

I put the .ogg file in /sounds/soundtrack.ogg. But this does not work:

var sound = new Media('sounds/soundtrack.ogg');
sound.play();

However, when I enter a remote file it will work, ie:

var sound = new Media('http://remote.com/file.ogg');
sound.play();

Am I using the wrong path?

请在android中使用file:///mnt/sdcard/sounds/soundtrack.ogg之类的文件路径,希望它对您有用。

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM