https://developers.weixin.qq.com/minigame/dev/guide/open-ability/game-recorder.html
游戏对局回放
录制好视频比视频快3.4秒左右
click(this.playNode, () => {
console.log('播放点击')
if (this.video.ing) {
this.recorder.stop();
this.video.ing = false;
} else {
this.video.ing = true;
this.recorder.start();
}
});
this.recorder.on('start', () => {
console.log("开始录制······")
})
this.recorder.on('stop', (res) => {
console.log(`对局回放时长: ${res.duration}`);
this.createShareBtn(res.duration);
})
createShareBtn(duration) {
// @ts-ignore
const button = wx.createGameRecorderShareButton({
// 样式参数
style: {
left: 10,
top: 150,
height: 50,
color: '#ffffff',
textAlign: 'center',
fontSize: 16,
borderRadius: 4,
iconMarginRight: 16,
paddingLeft: 1,
paddingRight: 30,
},
// 按钮的背景图片
// image: this.shareImgIcon,
text: '分享游戏时刻',
// icon: this.shareImgIcon,
// 分享参数
share: {
// 背景音乐的路径
bgm: 'walkin.mp3',
timeRange: [[0, duration]],
title: {
template: 'default.score',
data: {
score: 6500
}
},
button: {
template: 'play',
}
}
})
请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。