let _createPlayer = plus.audio.createPlayer();
_createPlayer.setSessionCategory("ambient");
setTimeout(()=>{
let path = plus.io.convertLocalFileSystemURL("/static/media/englishErr.mp3");
_createPlayer.setStyles({src:path,volume:1})
console.log(_createPlayer.getStyles())
_createPlayer.play();
},1000)
_createPlayer.addEventListener('error', console.log)
报错:
09:48:27.481 [LOG] : {"code":-4,"message":"file does not exist"}
console.log(AudioObj.getStyles()) 的输出
{
"autoplay": false,
"backgroundControl": false,
"loop": false,
"src": "/Users/zhangyingjie/Library/Developer/CoreSimulator/Devices/8B48A4AE-50EB-4414-B274-EA6EEE13560E/data/Containers/Data/Application/17EAE375-D736-47A0-8683-AE04090AE9C7/Documents/Pandora/apps/3C24DB1C22535238AF57382AE9D89C46/www/static/media/englishErr.mp3",
"startTime": 0,
"volume": 1
}
2 个回复
树下的老大爷 (作者)
我用终端 open这个输出的地址 是能找到文件的
树下的老大爷 (作者)
解决了:不能用plus.io.convertLocalFileSystemURL
直接写地址就行 "/static/media/englishErr.mp3"