Table of Contents

How to record and forward AR Session dump files

AR Session dump files are the core basis for the EasyAR team to troubleshoot and track issues.

Before you begin

What is an AR Session dump file

Important

AR Session dump files are the most important basis for analyzing and resolving Mega positioning and tracking issues on WeChat Mini Programs.

AR Session dump files record the key spatiotemporal context when a Mini Program makes Mega positioning requests.

How to record and forward

Control the recording process by calling the session.dumpSession(signal: boolean) interface:

  • Pass true: Start recording.
  • Pass false: Stop recording and return 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 prompt the start of recording. 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: 'Recording forwarded successfully',
              icon: 'success',
              duration: 2000
          });
      },
      fail() {
          wx.showToast({
              title: 'Recording 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 AR Session dump files, along with corresponding Toast prompts.


Note

Due to Mini Program local storage limitations (typically 200MB), it is recommended not to record for too long in a single session, and the maximum recording time should not exceed 10 minutes.