收藏
回答

ChooseMessageFile 安卓无法选择上传音频文件?

ChooseMessageFile 安卓无法选择上传音频文件如:mp3、wav,但是iOS可以

回答关注问题邀请回答
收藏

2 个回答

  • 智能回答 智能回答 本次回答由AI生成
    01-05
    有用 1
    回复
  • FiveBears
    FiveBears
    01-05

    chooseAudioAndSubtitleFiles(this: any) {

          const that = this;

          wx.chooseMessageFile({

            count: this.data.maxCount - this.data.audioList.length,

            type: 'all',

            extension: ['mp3', 'wav', 'aac', 'm4a', 'flac', 'aiff', 'ogg'],

            success(res: any) {

              that.handleSelectedFiles(res.tempFiles);

            },

          });

        },


        /**

         * 处理选中的文件

         */

        handleSelectedFiles(this: any, audioFiles: any[]) {

          const that = this;


          // 创建音频条目(标记为上传中)

          const newAudioItems = audioFiles.map((file: any, index: number) => {

            const item = that.createAudioItem(file);

            item.order = that.data.audioList.length + index + 1; // 修正order自增

            item.is_new = 1; // 标记为新增

            item.is_delete = 0; // 未删除

            if (item.audioFile) {

              item.audioFile.uploading = true; // 标记为上传中

            }

            return item;

          });


          let updatedList = [...that.data.audioList, ...newAudioItems];

          that.setData({ audioList: updatedList });


          // 开始上传音频文件

          audioFiles.forEach((file: any, index: number) => {

            that.uploadAudioFile(file, newAudioItems[index].id);

          });


          // 字幕上传功能已禁用,不再匹配和上传字幕

        },改成all图片tab有数据,但是文件tab没有数据,确定聊天中是有响应的文件的

    01-05
    有用 1
    回复
登录 后发表内容