wxstartRecord调用中IOS的兼容问题
2019-03-15 18:17:35
微信公开课小程序热门讨论关于「wxstartRecord调用中IOS的兼容问题」的小程序开发问题
补充:我点击一个按钮跳转到一个新页面,在页面初始化的时候,调取wxstartRecord({})安卓是没有问题的,而苹果只有第一次进入的时候会进入success,之后进入都是fail:function(res){录音失败如果我在页面添加一
展开:我点击一个按钮跳转到一个新页面,在页面初始化的时候,调取wxstartRecord({})安卓是没有问题的,而苹果只有第一次进入的时候会进入success,之后进入都是fail:function(res){ 录音失败如果我在页面添加一个按钮点击按钮录音的话,无论多少次都没有问题点击话筒进入苹果第一次进的时候进入success之后进入都是失败代码: onLoad:function(){ varthat=this; wxgetStorage({ key:search, success:function(res){ if(resdata){ thatsetData({ history_text:resdata, history_empty:false }) } }, fail:function(){没有缓存不显示 thatsetData({ history_empty:true }) } }) wxgetStorage({ key:userInfo, success:function(res){ if(resdatauserId){ thatsetData({ userId:resdatauserId }) } }, fail:function(){没有缓存不显示 thatsetData({ userId: }) } }) }, onShow:function(){ thismytouchstart(); }, onHide:function(){ 页面关闭 wxstopRecord() }, onUnload:function(){ 页面关闭 wxstopRecord() }, mytouchstart:function(){ consolelog(1) varthat=this 开始录音当主动调用wxstopRecord, 或者录音超过1分钟时自动结束录音,返回录音文件的临时文件路径 当用户离开小程序时,此接口无法调用 wxstopRecord() wxstartRecord({ success:function(res){ consolelog(录音成功+JSONstringify(res)); thatsetData({ voiceButtonName:语音识别, wavetoword:true, rewavetoword:true, recordingfailed:true, unrecognized:true, acousticwave:true, ensure:true, uploadfailed:true, wavewait:false, voicePlayButtonName:开始播放, tempFilePath:restempFilePath }) 上传语音文件至服务器 wxuploadFile({ url:http:test2, filePath:restempFilePath, name:file, header:{},设置请求的header formData:{ msg:voice },HTTP请求中其他额外的formdata success:function(res){ success consolelog(begin); consolelog(resdata); varjson=JSONparse(resdata); consolelog(jsonresult); varjsonResult=jsonresult; consolelog(jsonResult); varitem=jsonResult if(!item){ thatsetData({ acousticwave:true, wavewait:true, wavetoword:true, recordingfailed:true, ensure:true, uploadfailed:true, rewavetoword:false, unrecognized:false }) } elseif(item){ thatsetData({ val:item, acousticwave:true, recordingfailed:true, unrecognized:true, ensure:false, wavewait:true, uploadfailed:true, rewavetoword:false, wavetoword:false }) } }, fail:function(err){ thatsetData({ val:item, acousticwave:true, recordingfailed:true, ensure:true, unrecognized:true, wavewait:true, uploadfailed:false, rewavetoword:false, wavetoword:true }) fail consolelog(err); }, onVoiceRecordEnd:function(res){ consolelog(21) }, complete:function(){ complete } }) }, fail:function(res){ 录音失败 thatsetData({ voiceButtonName:语音识别, acousticwave:true, wavewait:true, wavetoword:true, rewavetoword:false, uploadfailed:true, ensure:true, recordingfailed:false, unrecognized:true }) consolelog(录音失败+JSONstringify(res)); } }) setTimeout(function(){ 结束录音 wxstopRecord() },5000) }, mytouchend:function(){ wxstopRecord() }即速小程序:简单的说就是IOS下如果在页面初始化时候调用wxstartRecord,只有第一次进来时会成功,之后进来都是录音失败
更多有关「wxstartRecord调用中IOS的兼容问题」的讨论可以前往微信公开课小程序参与互动哦!
补充:我点击一个按钮跳转到一个新页面,在页面初始化的时候,调取wxstartRecord({})安卓是没有问题的,而苹果只有第一次进入的时候会进入success,之后进入都是fail:function(res){录音失败如果我在页面添加一
展开:我点击一个按钮跳转到一个新页面,在页面初始化的时候,调取wxstartRecord({})安卓是没有问题的,而苹果只有第一次进入的时候会进入success,之后进入都是fail:function(res){ 录音失败如果我在页面添加一个按钮点击按钮录音的话,无论多少次都没有问题点击话筒进入苹果第一次进的时候进入success之后进入都是失败代码: onLoad:function(){ varthat=this; wxgetStorage({ key:search, success:function(res){ if(resdata){ thatsetData({ history_text:resdata, history_empty:false }) } }, fail:function(){没有缓存不显示 thatsetData({ history_empty:true }) } }) wxgetStorage({ key:userInfo, success:function(res){ if(resdatauserId){ thatsetData({ userId:resdatauserId }) } }, fail:function(){没有缓存不显示 thatsetData({ userId: }) } }) }, onShow:function(){ thismytouchstart(); }, onHide:function(){ 页面关闭 wxstopRecord() }, onUnload:function(){ 页面关闭 wxstopRecord() }, mytouchstart:function(){ consolelog(1) varthat=this 开始录音当主动调用wxstopRecord, 或者录音超过1分钟时自动结束录音,返回录音文件的临时文件路径 当用户离开小程序时,此接口无法调用 wxstopRecord() wxstartRecord({ success:function(res){ consolelog(录音成功+JSONstringify(res)); thatsetData({ voiceButtonName:语音识别, wavetoword:true, rewavetoword:true, recordingfailed:true, unrecognized:true, acousticwave:true, ensure:true, uploadfailed:true, wavewait:false, voicePlayButtonName:开始播放, tempFilePath:restempFilePath }) 上传语音文件至服务器 wxuploadFile({ url:http:test2, filePath:restempFilePath, name:file, header:{},设置请求的header formData:{ msg:voice },HTTP请求中其他额外的formdata success:function(res){ success consolelog(begin); consolelog(resdata); varjson=JSONparse(resdata); consolelog(jsonresult); varjsonResult=jsonresult; consolelog(jsonResult); varitem=jsonResult if(!item){ thatsetData({ acousticwave:true, wavewait:true, wavetoword:true, recordingfailed:true, ensure:true, uploadfailed:true, rewavetoword:false, unrecognized:false }) } elseif(item){ thatsetData({ val:item, acousticwave:true, recordingfailed:true, unrecognized:true, ensure:false, wavewait:true, uploadfailed:true, rewavetoword:false, wavetoword:false }) } }, fail:function(err){ thatsetData({ val:item, acousticwave:true, recordingfailed:true, ensure:true, unrecognized:true, wavewait:true, uploadfailed:false, rewavetoword:false, wavetoword:true }) fail consolelog(err); }, onVoiceRecordEnd:function(res){ consolelog(21) }, complete:function(){ complete } }) }, fail:function(res){ 录音失败 thatsetData({ voiceButtonName:语音识别, acousticwave:true, wavewait:true, wavetoword:true, rewavetoword:false, uploadfailed:true, ensure:true, recordingfailed:false, unrecognized:true }) consolelog(录音失败+JSONstringify(res)); } }) setTimeout(function(){ 结束录音 wxstopRecord() },5000) }, mytouchend:function(){ wxstopRecord() }即速小程序:简单的说就是IOS下如果在页面初始化时候调用wxstartRecord,只有第一次进来时会成功,之后进来都是录音失败
更多有关「wxstartRecord调用中IOS的兼容问题」的讨论可以前往微信公开课小程序参与互动哦!
标签:微信公开课,小程序
「wxstartRecord调用中IOS的兼容问题」热门讨论订阅
方法1:微信扫描微信公开课小程序码即可订阅热门讨论「wxstartRecord调用中IOS的兼容问题」
方法2:微信搜索微信公开课小程序名称进入,即可订阅热门讨论「wxstartRecord调用中IOS的兼容问题」
方法3:微信网页访问即速商店,长按识别微信公开课小程序码即可订阅热门讨论「wxstartRecord调用中IOS的兼容问题」
微信公开课小程序热门讨论「wxstartRecord调用中IOS的兼容问题」由微信公开课原创摘录于微信小程序商店shop.jisuapp.cn,转载请注明出处。
微信公开课热门讨论「wxstartRecord调用中IOS的兼容问题」由微信公开课开发者向微信用户提供,并对本服务内容、数据资料及其运营行为等真实性、合法性及有效性承担全部责任。
微信公开课小程序
更新时间:2019-03-15 18:17:35
>
__methodCallerx27;ofundefined
>-404011cloudfunctionexecutionerror
>,请补充选择商家自营-预付卡销售-发行方类目,并在基础信息处申请该类目,通过
>:host在模拟器中显示无效
>:请在小程序服务页面上架正式(非测试)内容或商品后重新提交审核
>.net 微信小程序 上传图片
>'setTimeout'的问题
>‘三朵里熙SPA主题减压空间’为什么搜索关键词‘三朵里‘搜不到
>‘扫普通链接二维码打开小程序‘中设置为体验版,扫码打开是线上版本
>“cloudfunctions**indexjs”gitignore
>“NO ULINK DEVICE FOUND”是怎么回事
>“万马掌上校园”的类目审核
>“上线了”公司开发的微信小程序怎么样?
>“产品是否一定需要条形码”
>