收藏
回答

wx.chooseMedia上传视频报错:errMsg: "chooseMedia:fail"?

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"}
  • 每天有大量异常,无法复现,埋点排查设备、微信版本都没什么规律

# 此类问题相关的帖子:

# 后续

  • 咨询了微信侧研发,发现是用户进入相册或者拍摄页面之后,直接把微信退到后台,导致取消的,就会报这个错
  • 因此这个报错不能作为实际问题发生的依据
最后一次编辑于  02-20
回答关注问题邀请回答
收藏

4 个回答

  • 社区技术运营专员-Jahozheng
    社区技术运营专员-Jahozheng
    2023-12-13

    完整报错是什么 请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。

    2023-12-13
    有用
    回复 1
    • REN.
      REN.
      2023-12-14
      完整报错就是fail回调的入参:{"errMsg":"chooseMedia:fail"},啥也看不出来,这个我们这边没法复现
      2023-12-14
      回复
  • Haydon Li
    Haydon Li
    03-23

    一样的问题,把错误发到服务器抓,少量用户,相册选择图片直接报这个错,大部分都是正常的,各种查没查到问题

    "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

        }

    03-23
    有用
    回复
  • 哲哲哲
    哲哲哲
    02-18

    我是发现通过微信聊天拍摄,保存下来的视频,无法上传,直接返回{"errMsg":"chooseMedia:fail"},如果把这个视频单独保存一下,就能上传了,人麻了

    02-18
    有用
    回复 1
    • 哲哲哲
      哲哲哲
      02-18
      我的报错信息给的稍微不一样
      02-18
      回复
  • 一笑皆春
    一笑皆春
    2023-12-13

    这个方法在PC端有很多问题,之前咨询过说是设置了maxDuration的原因,PC端不支持那么长的

    2023-12-13
    有用
    回复 1
    • REN.
      REN.
      2023-12-13
      埋点统计大部分都是移动端的,移动端设备没啥规律,IOS和安卓都有。之前那个chooseVideo有一堆异常,查文档结果说不维护了才改用chooseMedia,结果异常信息种类倒是收敛了,但异常量更多了,哎。
      2023-12-13
      回复
登录 后发表内容