How to record and forward ar session dump files
AR Session dump files are the core basis for the EasyAR team to investigate and track problems.
Before you start
- Understand what an AR Session is.
- Ensure your project has enabled EasyAR Mega.
What is an ar session dump file
Important
AR Session dump files are the most important basis for analyzing and solving Mega positioning and tracking problems on WeChat Mini Programs.
AR Session dump files record the key spatio-temporal context when a mini program makes a Mega positioning request.
How to record and forward
Control the recording process by calling the session.dumpSession(signal: boolean) interface:
- Pass
true: Starts recording. - Pass
false: Stops recording and returns the generated temporary file path (tempFilePath).
It is generally recommended to bind the recording logic to a UI button. When starting recording, use the wx.showToast() method to indicate the start. When recording ends, use the wx.shareFileMessage() method to forward the recorded file via WeChat chat.
/**
* Handle session recording logic
* @param signal true to start recording, false to stop recording and forward
*/
dumpSession(signal: boolean): void {
// Call the interface to get the path
const recordPath = session.dumpSession(signal);
// When signal is true, the interface returns an empty string, indicating that recording is in progress
if (recordPath.length == 0) {
wx.showToast({
title: 'Start recording data',
icon: 'success',
duration: 2000
});
return;
}
// When signal is false, process the returned file path
wx.shareFileMessage({
filePath: recordPath,
success() {
wx.showToast({
title: 'Record forwarded successfully',
icon: 'success',
duration: 2000
});
},
fail() {
wx.showToast({
title: 'Record forwarding failed',
icon: 'error',
duration: 2000
});
}
})
}
This example demonstrates how to use the
session.dumpSession()method in the xr-frame component to record and forward the AR Session dump file, and give the corresponding Toast prompt.
Note
Due to the local storage limit of the mini program (usually 200MB), it is recommended that the recording time for a single session should not be too long, and the maximum recording time must not exceed 10 minutes.