首先在小程序中增加一个发布到抖音按钮

<button open-type="uploadDouyinVideo">发布视频到抖音</button>
然后在page中增加以下代码,其中videoPath表示视频的url地址
Page({
async onUploadDouyinVideo(option) {
const title = await this.getTitle();
return {
// 传入videoPath表示上传videoPath对应的视频到抖音,没填videoPath代表拉起拍摄器拍摄视频
// videoPath: 'ttfile://xxx',
titleConfig: {
title
},
success() {
console.log("视频发布/挂载成功");
},
fail() {
console.log("视频发布/挂载失败");
},
};
},
getTitle() {
return new Promise((resolve) => {
setTimeout(() => {
resolve("This is a mock title");
}, 2000);
});
},
});
参考:https://developer.open-douyin.com/docs/resource/zh-CN/mini-app/develop/api/retweet/review
网友回复


