我使用此代码下载文件并将其存储在我的Android设备中 - >
fileTransfer.download(url, this.file.dataDirectory + 'music/' + file_name).then((entry) => {
alert('download complete: ' + entry.toURL());
}, (error) => {
// handle error
});
我能够获得下载文件的路径,即
file:///data/user/0/com.my.app/files/music/test.mp3
并尝试使用Media Controls插件播放此文件,代码在此处 - >
this.playButton = 'true';
this.file = new Audio();
this.file.src = "file:///data/user/0/com.my.app/files/music/test.mp3";
this.file.load();
但这对我不起作用,任何人都可以帮忙解决这个问题吗?
此问题仅适用于存储在设备中的文件,任何现场音乐的网址都能正常运行。