const fs = wx.getFileSystemManager(); //获取全局唯一的文件管理器
var pathStr=wx.env.USER_DATA_PATH + "/myvideo.mp3";//自己定文件类型,字节流写入MP3,或者string写入txt都行
//这是写入微信的文件缓存区
fs.writeFile({ // 写文件wx.env.USER_DATA_PATH + '/tmp.txt'
filePath: pathStr, // wx.env.USER_DATA_PATH 指定临时文件存入的路径,后面字符串自定义
data: res,
encoding: "utf8",
success (res){
console.log("语音写入成功路径filePath"+pathStr);
const test= require("../pages/test/test");
// test.playVoiceText(pathStr);
var innerAudioContext = wx.createInnerAudioContext()
innerAudioContext.src = pathStr;
innerAudioContext.play();
//这是自己主动另存相册的功能
// wx.saveVideoToPhotosAlbum({ // 新开页面打开文档
// filePath: pathStr, //拿上面存入的文件路径另存为
// success: function (res) {
// console.log("语音写入成功路径filePath"+filePath);
// // return filePath;
// }
// })
}
});