微信6.6.0版本智能录音接口调用失败
发布于 6 年前 作者 xiulanding 4583 次浏览 来自 问答

微信6.6.0版本打开微信网页调用录音后调用

wx.translateVoice({
localId: '', // 需要识别的音频的本地Id,由录音相关接口获得
isShowProgressTips: 1, // 默认为1,显示进度提示
success: function (res) {
alert(res.translateResult); // 语音识别的结果
}
});

失败,并且没有失败提示。

代码:

wx.stopRecord({

                        success: function (res) {

                          if (_this.enableSendRecord) {

                                //发送录音

                                wx.translateVoice({

                                    localId: res.localId, // 需要识别的音频的本地Id,由录音相关接口获得

                                    isShowProgressTips: 1, // 默认为1,显示进度提示

                                    success: function (res) {

                                         //console.log(res.translateResult); // 语音识别的结果

                                        var text = res.translateResult.replace("。", “”);

                                        if (text.length > 0) {

                                            _this.searchText = text;

                                            _this.search();

                                        } else {

                                            layer.confirm({

                                                msg: ‘语音无法识别,请重试’,

                                                cancelBtn: false,

                                                btnText1: ‘确定’

                                            })

                                        }

                                    },

                                    fail: function () {

                                        layer.confirm({

                                            msg: ‘语音无法识别,请重试’,

                                            cancelBtn: false,

                                            btnText1: ‘确定’

                                        })

                                    }

                                });

                            }

                        }

                    });

1 回复

问题怎么样了?

回到顶部