var plugin = requirePlugin("WechatSI")

const innerAudioContext = wx.createInnerAudioContext({ useWebAudioImplement: true })
innerAudioContext.onError(function (res) {
    console.log(res);
    console.log("语音播放失败");
})

export default function(message) {
	plugin.textToSpeech({
	    lang: "zh_CN",
	    tts: true,
	    content: message,
	    success: function(res) {
	        console.log("succ tts", res.filename)
			innerAudioContext.src = res.filename;
			innerAudioContext.play();
	    },
	    fail: function(res) {
	        console.log("fail tts", res)
	    }
	})
}


