Which eldest brother has the experience of developing Mini Program recording and uploading?

startRecode: function () {
    const options = {
      duration: 10000,// ms
      sampleRate: 16000,//
      numberOfChannels: 1,//
      encodeBitRate: 96000,//
      format: "mp3",
      frameSize: 50,// KB
    }
    recorderManager.start(options);
  },
  endRecode:function() {
    recorderManager.stop();
    var s = this;
    recorderManager.onStop((res) => {
      let audioFilePath = res.tempFilePath
      console.log(res)
      console.log(audioFilePath)
      wx.uploadFile({
        url: config.service.uploadUrl,
        filePath: audioFilePath,
        header:{
          miniProgram:"ios"
        },
        name: "file",
        success: function (res) {
          var data = res.data;
          console.log(res);
          if (data.states == 1) {
            var cEditData = s.data.editData;
            cEditData.recodeIdentity = data.identitys;
            s.setData({ editData: cEditData });
          }
          else {
            wx.showModal({
              title: "",
              content: data.message,
              showCancel: false,
              success: function (res) {

              }
            });
          }
          wx.hideToast();
        },
        fail: function (res) {
          console.log(res);
          wx.showModal({
            title: "",
            content: "",
            showCancel: false,
            success: function (res) {

            }
          });
          wx.hideToast();
        }
      });
      s.setData({ recodePath: audioFilePath });
    })
  },

this is why the code has added mimetypes: ["audio/x-aac"," audio/mpeg", "video/webm"," audio/mpeg", "audio/mp3"," audio/m4a"]
to cos to report the error {"code":-1, "error": "Cannot read property "mime" of null"}?


is caused by referencing the attribute 'mime'' somewhere. Look for

.
Menu