小程序
小游戏
企业微信
微信支付
扫描小程序码分享
请问微信小程序开发,在富文本编辑器插入视频,有没有 insertVideo 方法,用什么方法插入视频可以正常展示和播放?
2 个回答
加粗
标红
插入代码
插入链接
插入图片
上传视频
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' });
});
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
本回答由AI生成,可能已过期、失效或不适用于当前情形,请谨慎参考
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
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' });
}
});
},