收藏
回答

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
                    })
                }
            },
        })
    },
回答关注问题邀请回答
收藏

3 个回答

登录 后发表内容
问题标签