wx.chooseMedia({
count: 1,
mediaType: ['video'],
sizeType: ['compressed'],
sourceType: [sourceType],
maxDuration: 60,
camera: 'back',
)}
# 问题:
- 最近将wx.chooseVideo替换为了wx.chooseMedia,并使用wx.canIUse('chooseMedia')做了向后兼容,结果埋点发现有大量异常
- 用户调用chooseMedia上传视频,直接走了fail回调,异常信息:{errMsg: "chooseMedia:fail"}
- 每天有大量异常,无法复现,埋点排查设备、微信版本都没什么规律
# 此类问题相关的帖子:
# 后续
- 咨询了微信侧研发,发现是用户进入相册或者拍摄页面之后,直接把微信退到后台,导致取消的,就会报这个错
- 因此这个报错不能作为实际问题发生的依据
完整报错是什么 请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。
我这边也有遇到,真机复现了 华为 Pura 70,和切到后台没关系,是内存占用太高,把后台都杀掉就正常了
一样的问题,把错误发到服务器抓,少量用户,相册选择图片直接报这个错,大部分都是正常的,各种查没查到问题
"err": {
"errMsg": "chooseMedia:fail"
},
"system": {
"screenWidth": 360,
"cpuType": "MT6768V/CA",
"phoneCalendarAuthorized": true,
"windowHeight": 659,
"bluetoothEnabled": false,
"language": "zh_CN",
"microphoneAuthorized": true,
"fontSizeScaleFactor": 1,
"locationAuthorized": true,
"notificationAuthorized": true,
"model": "V1913A",
"statusBarHeight": 28,
"safeArea": {
"width": 360,
"right": 360,
"top": 25,
"left": 0,
"bottom": 780,
"height": 755
},
"brand": "vivo",
"windowWidth": 360,
"locationEnabled": true,
"benchmarkLevel": 20,
"screenHeight": 780,
"abi": "arm64-v8a",
"version": "8.0.42",
"cameraAuthorized": true,
"deviceAbi": "arm64-v8a",
"system": "Android 9",
"memorySize": 5701,
"fontSizeSetting": 16,
"pixelRatio": 3,
"deviceOrientation": "portrait",
"wifiEnabled": true,
"screenTop": 71,
"platform": "android",
"SDKVersion": "3.1.5",
"enableDebug": false,
"devicePixelRatio": 3,
"host": {
"env": "WeChat",
"version": 671099480
},
"mode": "default",
"deviceId": 1.7111615189494456e+19,
"safeAreaInsets": {
"top": 25,
"left": 0,
"right": 0,
"bottom": 0
},
"appId": "",
"appName": "*********",
"appVersion": "1.0.0",
"appVersionCode": 100,
"appLanguage": "zh-Hans",
"uniCompileVersion": 3.94,
"uniRuntimeVersion": 3.94,
"uniPlatform": "mp-weixin",
"deviceBrand": "vivo",
"deviceModel": "V1913A",
"deviceType": "phone",
"osName": "android",
"osVersion": 9,
"hostVersion": "8.0.42",
"hostLanguage": "zh-CN",
"hostName": "WeChat",
"hostSDKVersion": "3.1.5",
"hostFontSizeSetting": 16,
"windowTop": 0,
"windowBottom": 0
}
我是发现通过微信聊天拍摄,保存下来的视频,无法上传,直接返回{"errMsg":"chooseMedia:fail"},如果把这个视频单独保存一下,就能上传了,人麻了
{"tempFiles": [], "errMsg": "chooseMedia:fail", "type": "mix", "failedCount": 1}
这个方法在PC端有很多问题,之前咨询过说是设置了maxDuration的原因,PC端不支持那么长的