音频在sd卡上,同目录的图片能正常显示,文件显示存在,就是不能播放
let filePath = plus.io.convertLocalFileSystemURL(/storage/76FB-CFA0/oyuuntApp/1/1/1_1t.mp3
)
let fs = plus.io.resolveLocalFileSystemURL;
fs(filePath, function(entry) {
// 如果成功获取了文件入口,那么文件存在
console.log("文件存在: " + filePath);
}, function(error) {
// 如果发生错误,通常意味着文件不存在
console.error("文件不存在或无法访问: " + filePath);
});
this.read(filePath)
11:53:01.602 文件存在: /storage/76FB-CFA0/oyuuntApp/1/1/1_1t.mp3 at pages/index/index.vue:226
11:53:01.623 权限申请结果:, [Object] {"granted":["android.permission.READ_EXTERNAL_STORAGE","android.permission.WRITE_EXTERNAL_S...} at pages/index/index.vue:238
11:53:01.623 MediaError at pages/index/index.vue:348
11:53:01.624 [Number] -5 at pages/index/index.vue:349
read(src) {
innerAudioContext.stop();
innerAudioContext.src = src;
innerAudioContext.play();
innerAudioContext.onError((res) => {
console.log(res.errMsg);
console.log(res.errCode);
});
},
1 个回复
不卡BUG (作者)
音频在sd卡上,同目录的图片能正常显示,文件显示存在,就是不能播放
let filePath = plus.io.convertLocalFileSystemURL(
/storage/76FB-CFA0/oyuuntApp/1/1/1_1t.mp3
)let fs = plus.io.resolveLocalFileSystemURL;
fs(filePath, function(entry) {
// 如果成功获取了文件入口,那么文件存在
console.log("文件存在: " + filePath);
}, function(error) {
// 如果发生错误,通常意味着文件不存在
console.error("文件不存在或无法访问: " + filePath);
});
11:53:01.602 文件存在: /storage/76FB-CFA0/oyuuntApp/1/1/1_1t.mp3 at pages/index/index.vue:226
11:53:01.623 权限申请结果:, [Object] {"granted":["android.permission.READ_EXTERNAL_STORAGE","android.permission.WRITE_EXTERNAL_S...} at pages/index/index.vue:238
11:53:01.623 MediaError at pages/index/index.vue:348
11:53:01.624 [Number] -5 at pages/index/index.vue:349
read(src) {
innerAudioContext.stop();
innerAudioContext.src = src;
innerAudioContext.play();
innerAudioContext.onError((res) => {
console.log(res.errMsg);
console.log(res.errCode);
});
},