- 微信开发工具以及真机调试均无法开启websocket
这个是cocos creator2.2.2的项目文件:https://share.weiyun.com/hA2rdRaE 使用ccc运行均可正常运行,获得正确的数值176.84; 这个是在ccc构建出的微信小游戏打包:https://share.weiyun.com/RGS7suUr 在微信开发工具打开表现为websocket根本没有启动,显示的数值为默认的888.88
2020-10-05 - MiniProgramError module "xxx" is not defined无解
我是用的cocos creator2.2.2构建的微信小游戏包,然后在微信开发工具中打开就会出错(每次构建报错的脚本不一定一样) 随机出现以下错误 MiniProgramError module "libs/common/engine/InputManager.js" is not defined MiniProgramError module "libs/common/engine/Audio.js" is not defined MiniProgramError module "libs/common/engine/Canvas.js" is not defined等 我想知道这个是ccc的问题还是微信开发工具的问题? 此外,在微信开发工具运行没报错,但是如果使用微信开发工具的真机调试功能调试,也会出现上面的报错。
2020-10-05 - 已解决=ccc开发使用录音功能调试出错DevicesNotFoundError
- 当前 Bug 的表现(可附上截图) 点击录音按钮的时候微信开发工具提示 operateRecorder:fail DevicesNotFoundError 感觉像是没找到设备,模拟器提示这个,真机直接是卡在小游戏载入100%的界面 - 预期表现 - 复现路径 - 提供一个最简复现 Demo 我本来就是在一个小demo里面测试功能的,结果第一个录音的功能都出问题 麻烦大哥大姐大佬教主帮忙斧正,谢谢。 以下就是全部的代码: cc.Class({ extends: cc.Component, properties: { AnalyzeLabel:{ default:null, type:cc.Label }, }, onLoad: function () { wx.authorize({ scope: 'scope.record' }) console.log('scope record ----------'); //onload里面的代码都是有反应的,正常的会提示请求权限 }, //点击 开始录音 按钮的时候 onRecordBtnClick:function(){ const recorderManager = wx.getRecorderManager(); const innerAudioContext = wx.createInnerAudioContext(); let tempFilePath; let self = this; const options = { duration: 10000,//指定录音的时长,单位 ms sampleRate: 44100,//采样率 numberOfChannels: 1,//录音通道数 encodeBitRate: 192000,//编码码率 format: 'aac',//音频格式,有效值 aac/mp3 frameSize: 50,//指定帧大小,单位 KB } //开始录音 recorderManager.start(options); recorderManager.onStart(() => { console.log('recorder start') }); //错误回调 recorderManager.onError((res) => { self.AnalyzeLabel.string = 'record err:';//显示服务端消息 console.log(res); //<== 这句代码提示的operateRecorder:fail DevicesNotFoundError }) }, //停止录音 onStopRecordBtnClick:function(){ const recorderManager = wx.getRecorderManager(); let tempFilePath; recorderManager.stop(); recorderManager.onStop((res) => { this.tempFilePath = res.tempFilePath; console.log('recorder stop', res.tempFilePath) const { tempFilePath } = res }) }, //点击 播放录音 按钮的时候 onPlayRecordBtnClick:function(){ const innerAudioContext = wx.createInnerAudioContext(); let tempFilePath; innerAudioContext.autoplay = true; innerAudioContext.src = this.tempFilePath; innerAudioContext.onPlay(() => { console.log('开始播放') }); innerAudioContext.onError((res) => { console.log(res.errMsg) console.log(res.errCode) }); } });
2018-10-13