[Bug]: 前端每十秒save的event发送到controller, data要怎样正确拼接才可以正确回放, 现在我只能播放前十秒, 之后因为拼接出错, 一直播放失败 #1473
Open
1 task done
Labels
bug
Something isn't working
Preflight Checklist
What package is this bug report for?
rrweb
Version
2.0.0
Expected Behavior
[Bug]: 前端每十秒save的event发送到controller, data要怎样正确拼接才可以正确回放,
1.保存js
rrweb.record({
emit(event) {
// 用任意方式存储 event
console.log(event);
events.push(event);
},
});
2.回放js
function replay() {
let playbackId = 'playback-id';
$.ajax({
type: "GET",
url: "/rest/rrweb/playback/" + playbackId, //访问的链接
dataType: 'json',
success: function (resp) { //成功的回调函数
const records = JSON.parse(resp.data);
new rrwebPlayer({
target: document.getElementById("rrweb-player"),
data: {
events: records,
},
});
},
error: function (e) {
console.log("error:" + e.message);
}
});
}
后端controller部分
StringBuilder tmp;
@operation(summary = "保存记录")
@RequestMapping(method = RequestMethod.POST, value = "/save.html")
public AjaxResponse save(@RequestBody String data) {
tmp = new StringBuilder();
tmp.append(data);
return AjaxResponse.success(data);
}
@operation(summary = "回放")
@RequestMapping(method = RequestMethod.GET, value = "/playback/{playbackId}")
public AjaxResponse playback(@PathVariable String playbackId) {
log.info("access RRWeb playbackId: {}", playbackId);
return AjaxResponse.success(tmp.toString());
// return tmp;
}
Actual Behavior
现在我只能播放前十秒, 之后因为拼接出错, 一直播放失败
Steps to Reproduce
Testcase Gist URL
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: