var AVSpeechSynthesizer = plus.ios.importClass("AVSpeechSynthesizer");
var AVSpeechUtterance = plus.ios.importClass("AVSpeechUtterance");
var AVSpeechSynthesisVoice = plus.ios.import("AVSpeechSynthesisVoice");
var sppech = new AVSpeechSynthesizer();
var voice = AVSpeechSynthesisVoice.voiceWithLanguage("zh-CN");
var utterance = AVSpeechUtterance.speechUtteranceWithString("哈哈哈哈哈");
var delegate = plus.ios.implements("AVSpeechSynthesizerDelegate",
{"speechSynthesizer:didFinishSpeechUtterance:":function(){
console.log('info:已完成');
}});
sppech.plusSetAttribute('delegate', delegate);
// utterance.plusSetAttribute("rate",30.1);
utterance.setVoice(voice);
sppech.speakUtterance(utterance);
plus.ios.deleteObject(voice);
plus.ios.deleteObject(utterance);
plus.ios.deleteObject(sppech);
如上代码,添加监听播放完成代码会闪退,求解决方案,或者其他方法监听播放完成事件
4 个回复
8***@qq.com (作者)
mark
cydida
arguments.length 这个没有定义
8***@qq.com (作者)
去掉也没用
2018-04-27 14:16
cydida
崩溃已解决,但是他不调用完成之后的代码
2018-04-27 15:38
8***@qq.com (作者)
那要如何才能监听播放完成?
2018-04-27 18:15
ZHANGHANG
请问闪退问题解决了吗?
FullStack - 【插件开发】【专治疑难杂症】【ios上架、马甲包、白包、过审、已成功上架过几百个】【多款插件已上架:https://ext.dcloud.net.cn/publisher?id=22130】【非诚勿扰】QQ:543610866
离线文本转语音、支持生成音频、下载或播放状态监听(ios) :https://ext.dcloud.net.cn/plugin?id=9286