收藏
回答

微信小程序开发,在文本编辑器插入视频,有没有 insertVideo 方法,用什么方法可以正常播放?

请问微信小程序开发,在富文本编辑器插入视频,有没有 insertVideo 方法,用什么方法插入视频可以正常展示和播放?

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

2 个回答

  • 泰好记
    泰好记
    01-23

    chooseAndInsertVideo() {

        if (!this.data.editorReady{

          wx.showToast({ title: '编辑器正在初始化...', icon: 'none' });

          return;

        }


        wx.chooseMedia({

          count: 1,

          mediaType: ['video'],

          sourceType: ['album', 'camera'],

          maxDuration: 60,

          success: (res) => {

            const file = res.tempFiles[0];

            console.log('选中的视频:', file);


            this.insertVideoToEditor(file.tempFilePath, file.thumbTempFilePath);

          },

          fail: (err) => {

            console.error('选择视频失败:', err);

            wx.showToast({ title: '选择失败', icon: 'none' });

          }

        });

      },


    01-23
    有用
    回复
  • 智能回答 智能回答 本次回答由AI生成
    01-23
    有用
    回复
登录 后发表内容