收藏
回答

camera组件,调用stopRecord,没有拿到success回调?

小米10,使用camera组件,调用stopRecord没有成功回调,然后通过点击事件调用方法一直返回错误operateCamera:fail:is stopping

    startTimer: function () {
        let that = this;
        this.data.timer = setInterval(function () {
            that.data.time.second--;
            if (that.data.time.second === 1 && that.data.status.record === "recording") {
                that.stopRecord();
            }
            that.setData({
                time: that.data.time
            })
        }, 1000)
    },


    stopTimer: function () {
        clearInterval(this.data.timer);
    },


    stratRecord: function () {
        let that = this;
        this.cameraContext.startRecord({
            success: function (res) {
                console.log('开始录制')
                that.startTimer();
            },
            fail: function (res) {


            },
        })
    },


    stopRecord: function () {
        let that = this;
        this.cameraContext.stopRecord({
            success: function (res) {
                console.log('停止录制');
                that.data.video = res.tempVideoPath;
                that.data.img = res.tempThumbPath;
                that.stopTimer();
                that.data.status.record = 'success';
                that.data.time.second = 5;
                that.setData({
                    status: that.data.status,
                    video: that.data.video,
                    img: that.data.img,
                    time: that.data.time
                })
            },
            fail: function (res) {
                console.log(res);
                if(res.errMsg === "operateCamera:fail:is stopping"){


                } else {
                    that.stopTimer();
                    that.data.status.record === 'not';
                    that.data.time.second = 5;
                    that.setData({
                        status: that.data.status,
                        time: that.data.time
                    })
                }
            },
        })
    },
回答关注问题邀请回答
收藏

4 个回答

  • 金林
    金林
    2022-07-11

    问题解决了吗

    2022-07-11
    有用
    回复
  • 2021-08-05

    遇到同样问题,huwei--p40,一加手机,解决了吗?

    2021-08-05
    有用
    回复
  • 灵芝
    灵芝
    2020-06-09

    你好,麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html

    2020-06-09
    有用
    回复 1
    • 爱吃番茄的橘子猫
      爱吃番茄的橘子猫
      2021-06-02
      官方来个回复把!!!!!麻烦看下我最新提出的问题,谢谢
      2021-06-02
      回复
  • 子不语
    子不语
    2020-06-09

    fail呢?

    请学会如何「提问」(👈戳我)

    2020-06-09
    有用
    回复 2
    • tyus
      tyus
      2020-06-09
      第一次回调没有fail,后面事件触发一直是operateCamera:fail:is stopping
      2020-06-09
      回复
    • 爱吃番茄的橘子猫
      爱吃番茄的橘子猫
      2021-05-31回复tyus
      请问你解决了嘛
      2021-05-31
      回复
登录 后发表内容
问题标签