@multiplayer-app/session-recorder-react-native 1.3.36 → 2.0.17-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (289) hide show
  1. package/package.json +13 -8
  2. package/src/NativeSessionRecorderModule.ts +4 -2
  3. package/src/NativeSessionRecorderModuleSpec.ts +4 -2
  4. package/src/NativeSessionRecorderNative.ts +1 -1
  5. package/src/index.ts +0 -1
  6. package/src/native/SessionRecorderNative.ts +22 -13
  7. package/src/otel/helpers.ts +5 -1
  8. package/src/otel/index.ts +1 -1
  9. package/src/otel/instrumentations/index.ts +22 -22
  10. package/src/patch/configs.ts +15 -10
  11. package/src/patch/fetch.ts +98 -89
  12. package/src/patch/index.ts +1 -1
  13. package/src/patch/xhr.ts +3 -4
  14. package/src/services/screenRecordingService.ts +7 -2
  15. package/src/services/storage.service.ts +4 -1
  16. package/src/session-recorder.ts +4 -0
  17. package/src/types/configs.ts +1 -2
  18. package/lib/module/NativeSessionRecorderModule.js +0 -5
  19. package/lib/module/NativeSessionRecorderModule.js.map +0 -1
  20. package/lib/module/NativeSessionRecorderModuleSpec.js +0 -5
  21. package/lib/module/NativeSessionRecorderModuleSpec.js.map +0 -1
  22. package/lib/module/NativeSessionRecorderNative.js +0 -5
  23. package/lib/module/NativeSessionRecorderNative.js.map +0 -1
  24. package/lib/module/components/ErrorBoundary.js +0 -32
  25. package/lib/module/components/ErrorBoundary.js.map +0 -1
  26. package/lib/module/components/ScreenRecorderView/ScreenRecorderView.js +0 -23
  27. package/lib/module/components/ScreenRecorderView/ScreenRecorderView.js.map +0 -1
  28. package/lib/module/components/ScreenRecorderView/index.js +0 -4
  29. package/lib/module/components/ScreenRecorderView/index.js.map +0 -1
  30. package/lib/module/components/SessionRecorderWidget/ErrorBanner.js +0 -64
  31. package/lib/module/components/SessionRecorderWidget/ErrorBanner.js.map +0 -1
  32. package/lib/module/components/SessionRecorderWidget/FinalPopover.js +0 -74
  33. package/lib/module/components/SessionRecorderWidget/FinalPopover.js.map +0 -1
  34. package/lib/module/components/SessionRecorderWidget/FloatingButton.js +0 -191
  35. package/lib/module/components/SessionRecorderWidget/FloatingButton.js.map +0 -1
  36. package/lib/module/components/SessionRecorderWidget/InitialPopover.js +0 -138
  37. package/lib/module/components/SessionRecorderWidget/InitialPopover.js.map +0 -1
  38. package/lib/module/components/SessionRecorderWidget/ModalContainer.js +0 -177
  39. package/lib/module/components/SessionRecorderWidget/ModalContainer.js.map +0 -1
  40. package/lib/module/components/SessionRecorderWidget/ModalHeader.js +0 -27
  41. package/lib/module/components/SessionRecorderWidget/ModalHeader.js.map +0 -1
  42. package/lib/module/components/SessionRecorderWidget/SessionRecorderWidget.js +0 -133
  43. package/lib/module/components/SessionRecorderWidget/SessionRecorderWidget.js.map +0 -1
  44. package/lib/module/components/SessionRecorderWidget/icons.js +0 -93
  45. package/lib/module/components/SessionRecorderWidget/icons.js.map +0 -1
  46. package/lib/module/components/SessionRecorderWidget/index.js +0 -5
  47. package/lib/module/components/SessionRecorderWidget/index.js.map +0 -1
  48. package/lib/module/components/SessionRecorderWidget/styles.js +0 -173
  49. package/lib/module/components/SessionRecorderWidget/styles.js.map +0 -1
  50. package/lib/module/components/index.js +0 -6
  51. package/lib/module/components/index.js.map +0 -1
  52. package/lib/module/config/constants.js +0 -47
  53. package/lib/module/config/constants.js.map +0 -1
  54. package/lib/module/config/defaults.js +0 -87
  55. package/lib/module/config/defaults.js.map +0 -1
  56. package/lib/module/config/index.js +0 -9
  57. package/lib/module/config/index.js.map +0 -1
  58. package/lib/module/config/masking.js +0 -35
  59. package/lib/module/config/masking.js.map +0 -1
  60. package/lib/module/config/session-recorder.js +0 -50
  61. package/lib/module/config/session-recorder.js.map +0 -1
  62. package/lib/module/config/validators.js +0 -28
  63. package/lib/module/config/validators.js.map +0 -1
  64. package/lib/module/config/widget.js +0 -35
  65. package/lib/module/config/widget.js.map +0 -1
  66. package/lib/module/context/SessionRecorderContext.js +0 -100
  67. package/lib/module/context/SessionRecorderContext.js.map +0 -1
  68. package/lib/module/context/SessionRecorderStore.js +0 -12
  69. package/lib/module/context/SessionRecorderStore.js.map +0 -1
  70. package/lib/module/context/createStore.js +0 -27
  71. package/lib/module/context/createStore.js.map +0 -1
  72. package/lib/module/context/useSessionRecorderStore.js +0 -45
  73. package/lib/module/context/useSessionRecorderStore.js.map +0 -1
  74. package/lib/module/context/useStoreSelector.js +0 -27
  75. package/lib/module/context/useStoreSelector.js.map +0 -1
  76. package/lib/module/index.js +0 -14
  77. package/lib/module/index.js.map +0 -1
  78. package/lib/module/native/SessionRecorderNative.js +0 -76
  79. package/lib/module/native/SessionRecorderNative.js.map +0 -1
  80. package/lib/module/native/index.js +0 -4
  81. package/lib/module/native/index.js.map +0 -1
  82. package/lib/module/otel/CrashBufferSpanProcessor.js +0 -42
  83. package/lib/module/otel/CrashBufferSpanProcessor.js.map +0 -1
  84. package/lib/module/otel/helpers.js +0 -218
  85. package/lib/module/otel/helpers.js.map +0 -1
  86. package/lib/module/otel/index.js +0 -202
  87. package/lib/module/otel/index.js.map +0 -1
  88. package/lib/module/otel/instrumentations/index.js +0 -122
  89. package/lib/module/otel/instrumentations/index.js.map +0 -1
  90. package/lib/module/package.json +0 -1
  91. package/lib/module/patch/configs.js +0 -18
  92. package/lib/module/patch/configs.js.map +0 -1
  93. package/lib/module/patch/fetch.js +0 -224
  94. package/lib/module/patch/fetch.js.map +0 -1
  95. package/lib/module/patch/index.js +0 -6
  96. package/lib/module/patch/index.js.map +0 -1
  97. package/lib/module/patch/xhr.js +0 -100
  98. package/lib/module/patch/xhr.js.map +0 -1
  99. package/lib/module/recorder/gestureRecorder.js +0 -641
  100. package/lib/module/recorder/gestureRecorder.js.map +0 -1
  101. package/lib/module/recorder/index.js +0 -176
  102. package/lib/module/recorder/index.js.map +0 -1
  103. package/lib/module/recorder/navigationRecorder.js +0 -238
  104. package/lib/module/recorder/navigationRecorder.js.map +0 -1
  105. package/lib/module/recorder/screenRecorder.js +0 -527
  106. package/lib/module/recorder/screenRecorder.js.map +0 -1
  107. package/lib/module/services/api.service.js +0 -166
  108. package/lib/module/services/api.service.js.map +0 -1
  109. package/lib/module/services/crashBuffer.service.js +0 -280
  110. package/lib/module/services/crashBuffer.service.js.map +0 -1
  111. package/lib/module/services/network.service.js +0 -178
  112. package/lib/module/services/network.service.js.map +0 -1
  113. package/lib/module/services/screenRecordingService.js +0 -107
  114. package/lib/module/services/screenRecordingService.js.map +0 -1
  115. package/lib/module/services/socket.service.js +0 -186
  116. package/lib/module/services/socket.service.js.map +0 -1
  117. package/lib/module/services/storage.service.js +0 -178
  118. package/lib/module/services/storage.service.js.map +0 -1
  119. package/lib/module/session-recorder.js +0 -750
  120. package/lib/module/session-recorder.js.map +0 -1
  121. package/lib/module/types/configs.js +0 -4
  122. package/lib/module/types/configs.js.map +0 -1
  123. package/lib/module/types/expo-constants.d.js +0 -2
  124. package/lib/module/types/expo-constants.d.js.map +0 -1
  125. package/lib/module/types/index.js +0 -10
  126. package/lib/module/types/index.js.map +0 -1
  127. package/lib/module/types/session-recorder.js +0 -68
  128. package/lib/module/types/session-recorder.js.map +0 -1
  129. package/lib/module/utils/app-metadata.js +0 -28
  130. package/lib/module/utils/app-metadata.js.map +0 -1
  131. package/lib/module/utils/constants.optional.expo.js +0 -6
  132. package/lib/module/utils/constants.optional.expo.js.map +0 -1
  133. package/lib/module/utils/constants.optional.js +0 -8
  134. package/lib/module/utils/constants.optional.js.map +0 -1
  135. package/lib/module/utils/index.js +0 -11
  136. package/lib/module/utils/index.js.map +0 -1
  137. package/lib/module/utils/logger.js +0 -185
  138. package/lib/module/utils/logger.js.map +0 -1
  139. package/lib/module/utils/platform.js +0 -340
  140. package/lib/module/utils/platform.js.map +0 -1
  141. package/lib/module/utils/request-utils.js +0 -58
  142. package/lib/module/utils/request-utils.js.map +0 -1
  143. package/lib/module/utils/rrweb-events.js +0 -276
  144. package/lib/module/utils/rrweb-events.js.map +0 -1
  145. package/lib/module/utils/session.js +0 -21
  146. package/lib/module/utils/session.js.map +0 -1
  147. package/lib/module/utils/shallowEqual.js +0 -17
  148. package/lib/module/utils/shallowEqual.js.map +0 -1
  149. package/lib/module/utils/time.js +0 -17
  150. package/lib/module/utils/time.js.map +0 -1
  151. package/lib/module/utils/type-utils.js +0 -69
  152. package/lib/module/utils/type-utils.js.map +0 -1
  153. package/lib/module/version.js +0 -4
  154. package/lib/module/version.js.map +0 -1
  155. package/lib/typescript/package.json +0 -1
  156. package/lib/typescript/src/NativeSessionRecorderModule.d.ts +0 -25
  157. package/lib/typescript/src/NativeSessionRecorderModule.d.ts.map +0 -1
  158. package/lib/typescript/src/NativeSessionRecorderModuleSpec.d.ts +0 -25
  159. package/lib/typescript/src/NativeSessionRecorderModuleSpec.d.ts.map +0 -1
  160. package/lib/typescript/src/NativeSessionRecorderNative.d.ts +0 -25
  161. package/lib/typescript/src/NativeSessionRecorderNative.d.ts.map +0 -1
  162. package/lib/typescript/src/components/ErrorBoundary.d.ts +0 -16
  163. package/lib/typescript/src/components/ErrorBoundary.d.ts.map +0 -1
  164. package/lib/typescript/src/components/ScreenRecorderView/ScreenRecorderView.d.ts +0 -6
  165. package/lib/typescript/src/components/ScreenRecorderView/ScreenRecorderView.d.ts.map +0 -1
  166. package/lib/typescript/src/components/ScreenRecorderView/index.d.ts +0 -2
  167. package/lib/typescript/src/components/ScreenRecorderView/index.d.ts.map +0 -1
  168. package/lib/typescript/src/components/SessionRecorderWidget/ErrorBanner.d.ts +0 -8
  169. package/lib/typescript/src/components/SessionRecorderWidget/ErrorBanner.d.ts.map +0 -1
  170. package/lib/typescript/src/components/SessionRecorderWidget/FinalPopover.d.ts +0 -13
  171. package/lib/typescript/src/components/SessionRecorderWidget/FinalPopover.d.ts.map +0 -1
  172. package/lib/typescript/src/components/SessionRecorderWidget/FloatingButton.d.ts +0 -9
  173. package/lib/typescript/src/components/SessionRecorderWidget/FloatingButton.d.ts.map +0 -1
  174. package/lib/typescript/src/components/SessionRecorderWidget/InitialPopover.d.ts +0 -17
  175. package/lib/typescript/src/components/SessionRecorderWidget/InitialPopover.d.ts.map +0 -1
  176. package/lib/typescript/src/components/SessionRecorderWidget/ModalContainer.d.ts +0 -9
  177. package/lib/typescript/src/components/SessionRecorderWidget/ModalContainer.d.ts.map +0 -1
  178. package/lib/typescript/src/components/SessionRecorderWidget/ModalHeader.d.ts +0 -7
  179. package/lib/typescript/src/components/SessionRecorderWidget/ModalHeader.d.ts.map +0 -1
  180. package/lib/typescript/src/components/SessionRecorderWidget/SessionRecorderWidget.d.ts +0 -6
  181. package/lib/typescript/src/components/SessionRecorderWidget/SessionRecorderWidget.d.ts.map +0 -1
  182. package/lib/typescript/src/components/SessionRecorderWidget/icons.d.ts +0 -12
  183. package/lib/typescript/src/components/SessionRecorderWidget/icons.d.ts.map +0 -1
  184. package/lib/typescript/src/components/SessionRecorderWidget/index.d.ts +0 -3
  185. package/lib/typescript/src/components/SessionRecorderWidget/index.d.ts.map +0 -1
  186. package/lib/typescript/src/components/SessionRecorderWidget/styles.d.ts +0 -166
  187. package/lib/typescript/src/components/SessionRecorderWidget/styles.d.ts.map +0 -1
  188. package/lib/typescript/src/components/index.d.ts +0 -4
  189. package/lib/typescript/src/components/index.d.ts.map +0 -1
  190. package/lib/typescript/src/config/constants.d.ts +0 -22
  191. package/lib/typescript/src/config/constants.d.ts.map +0 -1
  192. package/lib/typescript/src/config/defaults.d.ts +0 -5
  193. package/lib/typescript/src/config/defaults.d.ts.map +0 -1
  194. package/lib/typescript/src/config/index.d.ts +0 -6
  195. package/lib/typescript/src/config/index.d.ts.map +0 -1
  196. package/lib/typescript/src/config/masking.d.ts +0 -3
  197. package/lib/typescript/src/config/masking.d.ts.map +0 -1
  198. package/lib/typescript/src/config/session-recorder.d.ts +0 -3
  199. package/lib/typescript/src/config/session-recorder.d.ts.map +0 -1
  200. package/lib/typescript/src/config/validators.d.ts +0 -11
  201. package/lib/typescript/src/config/validators.d.ts.map +0 -1
  202. package/lib/typescript/src/config/widget.d.ts +0 -10
  203. package/lib/typescript/src/config/widget.d.ts.map +0 -1
  204. package/lib/typescript/src/context/SessionRecorderContext.d.ts +0 -22
  205. package/lib/typescript/src/context/SessionRecorderContext.d.ts.map +0 -1
  206. package/lib/typescript/src/context/SessionRecorderStore.d.ts +0 -13
  207. package/lib/typescript/src/context/SessionRecorderStore.d.ts.map +0 -1
  208. package/lib/typescript/src/context/createStore.d.ts +0 -9
  209. package/lib/typescript/src/context/createStore.d.ts.map +0 -1
  210. package/lib/typescript/src/context/useSessionRecorderStore.d.ts +0 -29
  211. package/lib/typescript/src/context/useSessionRecorderStore.d.ts.map +0 -1
  212. package/lib/typescript/src/context/useStoreSelector.d.ts +0 -5
  213. package/lib/typescript/src/context/useStoreSelector.d.ts.map +0 -1
  214. package/lib/typescript/src/index.d.ts +0 -9
  215. package/lib/typescript/src/index.d.ts.map +0 -1
  216. package/lib/typescript/src/native/SessionRecorderNative.d.ts +0 -29
  217. package/lib/typescript/src/native/SessionRecorderNative.d.ts.map +0 -1
  218. package/lib/typescript/src/native/index.d.ts +0 -2
  219. package/lib/typescript/src/native/index.d.ts.map +0 -1
  220. package/lib/typescript/src/otel/CrashBufferSpanProcessor.d.ts +0 -17
  221. package/lib/typescript/src/otel/CrashBufferSpanProcessor.d.ts.map +0 -1
  222. package/lib/typescript/src/otel/helpers.d.ts +0 -46
  223. package/lib/typescript/src/otel/helpers.d.ts.map +0 -1
  224. package/lib/typescript/src/otel/index.d.ts +0 -33
  225. package/lib/typescript/src/otel/index.d.ts.map +0 -1
  226. package/lib/typescript/src/otel/instrumentations/index.d.ts +0 -5
  227. package/lib/typescript/src/otel/instrumentations/index.d.ts.map +0 -1
  228. package/lib/typescript/src/patch/configs.d.ts +0 -9
  229. package/lib/typescript/src/patch/configs.d.ts.map +0 -1
  230. package/lib/typescript/src/patch/fetch.d.ts +0 -2
  231. package/lib/typescript/src/patch/fetch.d.ts.map +0 -1
  232. package/lib/typescript/src/patch/index.d.ts +0 -4
  233. package/lib/typescript/src/patch/index.d.ts.map +0 -1
  234. package/lib/typescript/src/patch/xhr.d.ts +0 -2
  235. package/lib/typescript/src/patch/xhr.d.ts.map +0 -1
  236. package/lib/typescript/src/recorder/gestureRecorder.d.ts +0 -66
  237. package/lib/typescript/src/recorder/gestureRecorder.d.ts.map +0 -1
  238. package/lib/typescript/src/recorder/index.d.ts +0 -79
  239. package/lib/typescript/src/recorder/index.d.ts.map +0 -1
  240. package/lib/typescript/src/recorder/navigationRecorder.d.ts +0 -29
  241. package/lib/typescript/src/recorder/navigationRecorder.d.ts.map +0 -1
  242. package/lib/typescript/src/recorder/screenRecorder.d.ts +0 -127
  243. package/lib/typescript/src/recorder/screenRecorder.d.ts.map +0 -1
  244. package/lib/typescript/src/services/api.service.d.ts +0 -116
  245. package/lib/typescript/src/services/api.service.d.ts.map +0 -1
  246. package/lib/typescript/src/services/crashBuffer.service.d.ts +0 -27
  247. package/lib/typescript/src/services/crashBuffer.service.d.ts.map +0 -1
  248. package/lib/typescript/src/services/network.service.d.ts +0 -47
  249. package/lib/typescript/src/services/network.service.d.ts.map +0 -1
  250. package/lib/typescript/src/services/screenRecordingService.d.ts +0 -48
  251. package/lib/typescript/src/services/screenRecordingService.d.ts.map +0 -1
  252. package/lib/typescript/src/services/socket.service.d.ts +0 -44
  253. package/lib/typescript/src/services/socket.service.d.ts.map +0 -1
  254. package/lib/typescript/src/services/storage.service.d.ts +0 -47
  255. package/lib/typescript/src/services/storage.service.d.ts.map +0 -1
  256. package/lib/typescript/src/session-recorder.d.ts +0 -191
  257. package/lib/typescript/src/session-recorder.d.ts.map +0 -1
  258. package/lib/typescript/src/types/configs.d.ts +0 -92
  259. package/lib/typescript/src/types/configs.d.ts.map +0 -1
  260. package/lib/typescript/src/types/index.d.ts +0 -21
  261. package/lib/typescript/src/types/index.d.ts.map +0 -1
  262. package/lib/typescript/src/types/session-recorder.d.ts +0 -367
  263. package/lib/typescript/src/types/session-recorder.d.ts.map +0 -1
  264. package/lib/typescript/src/utils/app-metadata.d.ts +0 -17
  265. package/lib/typescript/src/utils/app-metadata.d.ts.map +0 -1
  266. package/lib/typescript/src/utils/constants.optional.d.ts +0 -22
  267. package/lib/typescript/src/utils/constants.optional.d.ts.map +0 -1
  268. package/lib/typescript/src/utils/constants.optional.expo.d.ts +0 -4
  269. package/lib/typescript/src/utils/constants.optional.expo.d.ts.map +0 -1
  270. package/lib/typescript/src/utils/index.d.ts +0 -8
  271. package/lib/typescript/src/utils/index.d.ts.map +0 -1
  272. package/lib/typescript/src/utils/logger.d.ts +0 -108
  273. package/lib/typescript/src/utils/logger.d.ts.map +0 -1
  274. package/lib/typescript/src/utils/platform.d.ts +0 -58
  275. package/lib/typescript/src/utils/platform.d.ts.map +0 -1
  276. package/lib/typescript/src/utils/request-utils.d.ts +0 -22
  277. package/lib/typescript/src/utils/request-utils.d.ts.map +0 -1
  278. package/lib/typescript/src/utils/rrweb-events.d.ts +0 -67
  279. package/lib/typescript/src/utils/rrweb-events.d.ts.map +0 -1
  280. package/lib/typescript/src/utils/session.d.ts +0 -7
  281. package/lib/typescript/src/utils/session.d.ts.map +0 -1
  282. package/lib/typescript/src/utils/shallowEqual.d.ts +0 -2
  283. package/lib/typescript/src/utils/shallowEqual.d.ts.map +0 -1
  284. package/lib/typescript/src/utils/time.d.ts +0 -5
  285. package/lib/typescript/src/utils/time.d.ts.map +0 -1
  286. package/lib/typescript/src/utils/type-utils.d.ts +0 -17
  287. package/lib/typescript/src/utils/type-utils.d.ts.map +0 -1
  288. package/lib/typescript/src/version.d.ts +0 -2
  289. package/lib/typescript/src/version.d.ts.map +0 -1
@@ -1,527 +0,0 @@
1
- "use strict";
2
-
3
- import { trace, SpanStatusCode } from '@opentelemetry/api';
4
- import { Dimensions, Platform } from 'react-native';
5
- import { createRecordingMetaEvent, createFullSnapshotEvent, createIncrementalSnapshotWithImageUpdate as createIncrementalSnapshotUtil, generateScreenHash, logger } from "../utils/index.js";
6
- import { screenRecordingService } from "../services/screenRecordingService.js";
7
- const isWeb = Platform.OS === 'web';
8
- export class ScreenRecorder {
9
- isRecording = false;
10
- isBufferOnlyMode = false;
11
- needsFullSnapshot = true;
12
- events = [];
13
- captureCount = 0;
14
- maxCaptures = 100; // Limit captures to prevent memory issues
15
- captureQuality = 0.2;
16
- captureScale = 0.33;
17
- captureFormat = 'jpg';
18
- screenDimensions = null;
19
- nodeIdCounter = 1;
20
- lastScreenCapture = null;
21
- lastScreenHash = null;
22
- enableChangeDetection = true;
23
- hashSampleSize = 100;
24
- currentImageNodeId = null;
25
- viewShotRef = null;
26
- init(config, eventRecorder) {
27
- this.config = config;
28
- this.eventRecorder = eventRecorder;
29
- this._getScreenDimensions();
30
-
31
- // Initialize masking configuration
32
- this.recordingConfig = {
33
- enabled: true,
34
- ...this.config.masking
35
- };
36
-
37
- // Update the masking service configuration
38
- screenRecordingService.updateConfig(this.recordingConfig);
39
- }
40
- start() {
41
- this.isRecording = true;
42
- this.needsFullSnapshot = true;
43
- this.events = [];
44
- this.captureCount = 0;
45
- this.lastScreenCapture = null;
46
- this.lastScreenHash = null;
47
- this.currentImageNodeId = null; // Reset image node ID for new session
48
- logger.info('ScreenRecorder', 'Screen recording started');
49
- this._startPeriodicCapture();
50
- this._startBufferSnapshotInterval();
51
- // Capture initial screen immediately
52
- this._captureScreen();
53
- }
54
- stop() {
55
- this.isRecording = false;
56
- this._stopPeriodicCapture();
57
- this._stopBufferSnapshotInterval();
58
- // Screen recording stopped
59
- }
60
- pause() {
61
- this.isRecording = false;
62
- this._stopPeriodicCapture();
63
- this._stopBufferSnapshotInterval();
64
- }
65
- resume() {
66
- this.isRecording = true;
67
- this._startPeriodicCapture();
68
- this._startBufferSnapshotInterval();
69
- }
70
-
71
- /**
72
- * Enables behavior specific to crash-buffer-only mode.
73
- * In this mode we periodically force a full snapshot anchor for replayability.
74
- */
75
- setBufferOnlyMode(enabled) {
76
- this.isBufferOnlyMode = enabled;
77
- if (!enabled) {
78
- this.needsFullSnapshot = false;
79
- this._stopBufferSnapshotInterval();
80
- return;
81
- }
82
- this.needsFullSnapshot = true;
83
- if (this.isRecording) {
84
- this._startBufferSnapshotInterval();
85
- }
86
- }
87
- _getScreenDimensions() {
88
- try {
89
- this.screenDimensions = Dimensions.get('window');
90
- } catch (error) {
91
- // Failed to get screen dimensions - silently continue
92
- this.screenDimensions = {
93
- width: 375,
94
- height: 667
95
- }; // Default fallback
96
- }
97
- }
98
- _startPeriodicCapture() {
99
- if (this.captureInterval) {
100
- clearInterval(this.captureInterval);
101
- }
102
-
103
- // Capture screen every 5 seconds (reduced frequency)
104
- this.captureInterval = setInterval(() => {
105
- this._captureScreen();
106
- }, 5000);
107
- }
108
- _stopPeriodicCapture() {
109
- if (this.captureInterval) {
110
- clearInterval(this.captureInterval);
111
- this.captureInterval = undefined;
112
- }
113
- }
114
- _startBufferSnapshotInterval() {
115
- this._stopBufferSnapshotInterval();
116
- if (!this.isBufferOnlyMode) {
117
- return;
118
- }
119
- const configuredInterval = this.config?.buffering?.snapshotIntervalMs || 20000;
120
- const intervalMs = Math.max(5000, configuredInterval);
121
- this.bufferSnapshotInterval = setInterval(() => {
122
- // Force a fresh full snapshot anchor in buffer-only mode.
123
- this.needsFullSnapshot = true;
124
- void this._captureScreen();
125
- }, intervalMs);
126
- }
127
- _stopBufferSnapshotInterval() {
128
- if (this.bufferSnapshotInterval) {
129
- clearInterval(this.bufferSnapshotInterval);
130
- this.bufferSnapshotInterval = undefined;
131
- }
132
- }
133
- async _captureScreen(timestamp) {
134
- if (!this.isRecording || this.captureCount >= this.maxCaptures) return;
135
- try {
136
- const base64Image = await this._captureScreenBase64();
137
- if (base64Image) {
138
- // Check if screen has changed by comparing with previous capture
139
- const hasChanged = this.enableChangeDetection ? this._hasScreenChanged(base64Image) : true;
140
- if (hasChanged) {
141
- // Keep replay segments anchored: buffer-only mode can force a full snapshot.
142
- const shouldEmitFullSnapshot = this.needsFullSnapshot || this.currentImageNodeId === null || !this.lastScreenCapture;
143
- if (!shouldEmitFullSnapshot) {
144
- const success = this.updateScreenWithIncrementalSnapshot(base64Image, timestamp);
145
- if (!success) {
146
- // Fallback to full snapshot if incremental update fails
147
- this._createAndEmitFullSnapshotEvent(base64Image, timestamp);
148
- this.needsFullSnapshot = false;
149
- }
150
- } else {
151
- // First capture, forced anchor, or no existing image node.
152
- this._createAndEmitFullSnapshotEvent(base64Image, timestamp);
153
- this.needsFullSnapshot = false;
154
- }
155
- this.lastScreenCapture = base64Image;
156
- this.lastScreenHash = this._generateScreenHash(base64Image);
157
- this.captureCount++;
158
- }
159
- }
160
- } catch (error) {
161
- this._recordScreenCaptureError(error);
162
- }
163
- }
164
- async _captureScreenBase64() {
165
- try {
166
- // Check if we're on web platform
167
- if (isWeb) {
168
- logger.warn('ScreenRecorder', 'Screen capture not available on web platform');
169
- return null;
170
- }
171
-
172
- // Try native masking first if available
173
- if (screenRecordingService.isScreenRecordingAvailable()) {
174
- logger.info('ScreenRecorder', 'Using native masking for screen capture');
175
- const recordingImage = await screenRecordingService.captureMaskedScreen({
176
- quality: this.captureQuality,
177
- scale: this.captureScale
178
- });
179
- if (recordingImage) {
180
- return recordingImage;
181
- }
182
- logger.warn('ScreenRecorder', 'Native masking failed, falling back to view-shot');
183
- }
184
-
185
- // // Fallback to react-native-view-shot
186
- if (!this.viewShotRef) {
187
- logger.warn('ScreenRecorder', 'ViewShot ref not available for screen capture');
188
- return null;
189
- }
190
- return null;
191
-
192
- // // Check if captureRef is available
193
- // if (!captureRef) {
194
- // logger.warn('ScreenRecorder', 'react-native-view-shot not available');
195
- // return null;
196
- // }
197
-
198
- // // Capture the screen using react-native-view-shot
199
- // const result = await captureRef(this.viewShotRef, {
200
- // format: this.captureFormat,
201
- // quality: this.captureQuality,
202
- // result: 'base64',
203
- // });
204
-
205
- // return result;
206
- } catch (error) {
207
- logger.error('ScreenRecorder', 'Failed to capture screen. Make sure react-native-view-shot is properly installed and linked:', error);
208
- return null;
209
- }
210
- }
211
- _createAndEmitFullSnapshotEvent(base64Image, timestamp) {
212
- if (!this.screenDimensions) return;
213
-
214
- // Keep replay anchors valid: each full snapshot is explicitly preceded by meta.
215
- this.recordEvent(createRecordingMetaEvent());
216
-
217
- // Use the new createFullSnapshot method
218
- const fullSnapshotEvent = this.createFullSnapshot(base64Image, timestamp);
219
- this.recordEvent(fullSnapshotEvent);
220
- }
221
-
222
- /**
223
- * Create a full snapshot event with the given base64 image
224
- * @param base64Image - Base64 encoded image data
225
- * @param timestamp - Optional timestamp to use for the event
226
- * @returns Full snapshot event
227
- */
228
- createFullSnapshot(base64Image, timestamp) {
229
- if (!this.screenDimensions) {
230
- throw new Error('Screen dimensions not available');
231
- }
232
- const {
233
- width,
234
- height
235
- } = this.screenDimensions;
236
- this.nodeIdCounter = 1;
237
-
238
- // Use utility function to create full snapshot event
239
- const fullSnapshotEvent = createFullSnapshotEvent(base64Image, width, height, this.captureFormat, {
240
- current: this.nodeIdCounter
241
- }, timestamp);
242
-
243
- // Store the image node ID for future incremental updates
244
- // The image node ID is the first node created (after the document)
245
- this.currentImageNodeId = 0; // First element node is the image
246
-
247
- return fullSnapshotEvent;
248
- }
249
-
250
- /**
251
- * Create an incremental snapshot event with mutation data to update image src
252
- * @param base64Image - New base64 encoded image data
253
- * @param captureFormat - Image format (png, jpg, etc.)
254
- * @param timestamp - Optional timestamp to use for the event
255
- * @returns Incremental snapshot event with mutation data
256
- */
257
- createIncrementalSnapshotWithImageUpdate(base64Image, captureFormat, timestamp) {
258
- return createIncrementalSnapshotUtil(base64Image, captureFormat || this.captureFormat, timestamp);
259
- }
260
-
261
- /**
262
- * Update the screen with a new image using incremental snapshot
263
- * @param base64Image - New base64 encoded image data
264
- * @param timestamp - Optional timestamp to use for the event
265
- * @returns true if update was successful, false otherwise
266
- */
267
- updateScreenWithIncrementalSnapshot(base64Image, timestamp) {
268
- if (this.currentImageNodeId === null) {
269
- logger.warn('ScreenRecorder', 'No image node ID available for incremental update');
270
- return false;
271
- }
272
- const incrementalEvent = this.createIncrementalSnapshotWithImageUpdate(base64Image, 'jpg', timestamp);
273
- this.recordEvent(incrementalEvent);
274
- return true;
275
- }
276
-
277
- /**
278
- * Force a full snapshot (useful when screen dimensions change or for debugging)
279
- * @param base64Image - Base64 encoded image data
280
- */
281
- forceFullSnapshot(base64Image) {
282
- this._createAndEmitFullSnapshotEvent(base64Image);
283
- this.lastScreenCapture = base64Image;
284
- this.lastScreenHash = this._generateScreenHash(base64Image);
285
- this.captureCount++;
286
- }
287
-
288
- /**
289
- * Check if the screen has changed by comparing with the previous capture
290
- * @param currentBase64 - Current screen capture as base64
291
- * @returns true if screen has changed, false otherwise
292
- */
293
- _hasScreenChanged(currentBase64) {
294
- // If this is the first capture, consider it changed
295
- if (!this.lastScreenCapture) {
296
- return true;
297
- }
298
-
299
- // Generate hash for current capture
300
- const currentHash = this._generateScreenHash(currentBase64);
301
-
302
- // Compare with previous hash
303
- return currentHash !== this.lastScreenHash;
304
- }
305
-
306
- /**
307
- * Generate a simple hash for screen comparison
308
- * This is a lightweight hash that focuses on the beginning and end of the base64 string
309
- * to detect changes without doing a full comparison
310
- * @param base64Image - Base64 encoded image
311
- * @returns Hash string for comparison
312
- */
313
- _generateScreenHash(base64Image) {
314
- return generateScreenHash(base64Image, this.hashSampleSize);
315
- }
316
- _sendEvent(_event) {
317
- // Screen event recorded
318
- // Send event to backend or store locally
319
- }
320
- _recordOpenTelemetrySpan(event) {
321
- try {
322
- const span = trace.getTracer('screen').startSpan(`Screen.${event.type}`, {
323
- attributes: {
324
- 'screen.type': event.type,
325
- 'screen.timestamp': event.timestamp,
326
- 'screen.platform': 'react-native'
327
- }
328
- });
329
- if (event.metadata) {
330
- Object.entries(event.metadata).forEach(([key, value]) => {
331
- span.setAttribute(`screen.metadata.${key}`, String(value));
332
- });
333
- }
334
- span.setStatus({
335
- code: SpanStatusCode.OK
336
- });
337
- span.end();
338
- } catch (error) {
339
- // Failed to record OpenTelemetry span for screen - silently continue
340
- }
341
- }
342
- _recordScreenCaptureError(error) {
343
- try {
344
- const span = trace.getTracer('screen').startSpan('Screen.capture.error', {
345
- attributes: {
346
- 'screen.error': true,
347
- 'screen.error.type': error.name,
348
- 'screen.error.message': error.message,
349
- 'screen.timestamp': Date.now()
350
- }
351
- });
352
- span.setStatus({
353
- code: SpanStatusCode.ERROR,
354
- message: error.message
355
- });
356
- span.recordException(error);
357
- span.end();
358
- } catch (spanError) {
359
- // Failed to record error span - silently continue
360
- }
361
- }
362
-
363
- // Configuration methods
364
- setCaptureInterval(intervalMs) {
365
- if (this.captureInterval) {
366
- clearInterval(this.captureInterval);
367
- }
368
- if (this.isRecording) {
369
- this.captureInterval = setInterval(() => {
370
- this._captureScreen();
371
- }, intervalMs);
372
- }
373
- }
374
- setCaptureQuality(quality) {
375
- this.captureQuality = Math.max(0.1, Math.min(1.0, quality));
376
- }
377
- setCaptureFormat(format) {
378
- this.captureFormat = format;
379
- }
380
- setMaxCaptures(max) {
381
- this.maxCaptures = Math.max(1, max);
382
- }
383
-
384
- /**
385
- * Enable or disable change detection
386
- * @param enabled - Whether to enable change detection
387
- */
388
- setChangeDetection(enabled) {
389
- this.enableChangeDetection = enabled;
390
- }
391
-
392
- /**
393
- * Set the hash sample size for change detection
394
- * @param size - Number of characters to sample from each part of the image
395
- */
396
- setHashSampleSize(size) {
397
- this.hashSampleSize = Math.max(10, Math.min(1000, size));
398
- }
399
-
400
- // Performance monitoring
401
- recordScreenPerformance(screenName, loadTime) {
402
- const event = {
403
- screenName,
404
- type: 'screenCapture',
405
- timestamp: Date.now(),
406
- metadata: {
407
- screenName,
408
- loadTime,
409
- performance: 'monitoring',
410
- captureCount: this.captureCount
411
- }
412
- };
413
- this.events.push(event);
414
- this._sendEvent(event);
415
- this._recordOpenTelemetrySpan(event);
416
- this.events.push(event);
417
- this._sendEvent(event);
418
- this._recordOpenTelemetrySpan(event);
419
- }
420
-
421
- // Error tracking
422
- recordScreenError(error, screenName) {
423
- const event = {
424
- screenName: screenName || 'unknown',
425
- type: 'screenCapture',
426
- timestamp: Date.now(),
427
- metadata: {
428
- error: true,
429
- errorType: error.name,
430
- errorMessage: error.message,
431
- screenName,
432
- captureCount: this.captureCount
433
- }
434
- };
435
- this.events.push(event);
436
- this._sendEvent(event);
437
- this._recordOpenTelemetrySpan(event);
438
- this.events.push(event);
439
- this._sendEvent(event);
440
- this._recordScreenCaptureError(error);
441
- }
442
-
443
- // Get recorded events
444
- getEvents() {
445
- return [...this.events];
446
- }
447
-
448
- // Clear events
449
- clearEvents() {
450
- this.events = [];
451
- this.captureCount = 0;
452
- }
453
-
454
- // Get screen capture statistics
455
- getScreenStats() {
456
- const stats = {
457
- totalCaptures: this.captureCount,
458
- totalEvents: this.events.length,
459
- averageCaptureTime: 0,
460
- successRate: 0
461
- };
462
- if (this.events.length > 0) {
463
- const captureTimes = this.events.map(event => event.metadata?.captureTime || 0).filter(time => time > 0);
464
- if (captureTimes.length > 0) {
465
- stats.averageCaptureTime = captureTimes.reduce((a, b) => a + b, 0) / captureTimes.length;
466
- }
467
- const successfulCaptures = this.events.filter(event => event.dataUrl).length;
468
- stats.successRate = successfulCaptures / this.events.length * 100;
469
- }
470
- return stats;
471
- }
472
-
473
- // Get recording status
474
- isRecordingEnabled() {
475
- return this.isRecording;
476
- }
477
-
478
- // Get current configuration
479
- getConfiguration() {
480
- return {
481
- captureInterval: this.captureInterval ? 2000 : 0,
482
- // Default 5 seconds
483
- captureQuality: this.captureQuality,
484
- captureFormat: this.captureFormat,
485
- maxCaptures: this.maxCaptures,
486
- screenDimensions: this.screenDimensions
487
- };
488
- }
489
-
490
- // Shutdown
491
- shutdown() {
492
- this.stop();
493
- this.clearEvents();
494
- // Screen recorder shutdown
495
- }
496
-
497
- /**
498
- * Set the viewshot ref for screen capture
499
- * @param ref - React Native View ref for screen capture
500
- */
501
- setViewShotRef(ref) {
502
- this.viewShotRef = ref;
503
- }
504
-
505
- /**
506
- * Force capture screen (useful after touch interactions)
507
- * This bypasses the change detection and always captures
508
- * @param timestamp - Optional timestamp to use for the capture event
509
- */
510
- forceCapture(timestamp) {
511
- if (!this.isRecording) {
512
- return;
513
- }
514
- this._captureScreen(timestamp);
515
- }
516
-
517
- /**
518
- * Record an rrweb event
519
- * @param event - The rrweb event to record
520
- */
521
- recordEvent(event) {
522
- if (this.eventRecorder) {
523
- this.eventRecorder.recordEvent(event);
524
- }
525
- }
526
- }
527
- //# sourceMappingURL=screenRecorder.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["trace","SpanStatusCode","Dimensions","Platform","createRecordingMetaEvent","createFullSnapshotEvent","createIncrementalSnapshotWithImageUpdate","createIncrementalSnapshotUtil","generateScreenHash","logger","screenRecordingService","isWeb","OS","ScreenRecorder","isRecording","isBufferOnlyMode","needsFullSnapshot","events","captureCount","maxCaptures","captureQuality","captureScale","captureFormat","screenDimensions","nodeIdCounter","lastScreenCapture","lastScreenHash","enableChangeDetection","hashSampleSize","currentImageNodeId","viewShotRef","init","config","eventRecorder","_getScreenDimensions","recordingConfig","enabled","masking","updateConfig","start","info","_startPeriodicCapture","_startBufferSnapshotInterval","_captureScreen","stop","_stopPeriodicCapture","_stopBufferSnapshotInterval","pause","resume","setBufferOnlyMode","get","error","width","height","captureInterval","clearInterval","setInterval","undefined","configuredInterval","buffering","snapshotIntervalMs","intervalMs","Math","max","bufferSnapshotInterval","timestamp","base64Image","_captureScreenBase64","hasChanged","_hasScreenChanged","shouldEmitFullSnapshot","success","updateScreenWithIncrementalSnapshot","_createAndEmitFullSnapshotEvent","_generateScreenHash","_recordScreenCaptureError","warn","isScreenRecordingAvailable","recordingImage","captureMaskedScreen","quality","scale","recordEvent","fullSnapshotEvent","createFullSnapshot","Error","current","incrementalEvent","forceFullSnapshot","currentBase64","currentHash","_sendEvent","_event","_recordOpenTelemetrySpan","event","span","getTracer","startSpan","type","attributes","metadata","Object","entries","forEach","key","value","setAttribute","String","setStatus","code","OK","end","name","message","Date","now","ERROR","recordException","spanError","setCaptureInterval","setCaptureQuality","min","setCaptureFormat","format","setMaxCaptures","setChangeDetection","setHashSampleSize","size","recordScreenPerformance","screenName","loadTime","performance","push","recordScreenError","errorType","errorMessage","getEvents","clearEvents","getScreenStats","stats","totalCaptures","totalEvents","length","averageCaptureTime","successRate","captureTimes","map","captureTime","filter","time","reduce","a","b","successfulCaptures","dataUrl","isRecordingEnabled","getConfiguration","shutdown","setViewShotRef","ref","forceCapture"],"sourceRoot":"../../../src","sources":["recorder/screenRecorder.ts"],"mappings":";;AAMA,SAASA,KAAK,EAAEC,cAAc,QAAQ,oBAAoB;AAC1D,SAASC,UAAU,EAAEC,QAAQ,QAAQ,cAAc;AACnD,SACEC,wBAAwB,EACxBC,uBAAuB,EACvBC,wCAAwC,IAAIC,6BAA6B,EACzEC,kBAAkB,EAClBC,MAAM,QACD,mBAAU;AACjB,SACEC,sBAAsB,QAEjB,uCAAoC;AAC3C,MAAMC,KAAK,GAAGR,QAAQ,CAACS,EAAE,KAAK,KAAK;AAEnC,OAAO,MAAMC,cAAc,CAA0B;EAE3CC,WAAW,GAAG,KAAK;EACnBC,gBAAgB,GAAG,KAAK;EACxBC,iBAAiB,GAAG,IAAI;EACxBC,MAAM,GAAkB,EAAE;EAG1BC,YAAY,GAAW,CAAC;EACxBC,WAAW,GAAW,GAAG,CAAC,CAAC;EAC3BC,cAAc,GAAW,GAAG;EAC5BC,YAAY,GAAW,IAAI;EAC3BC,aAAa,GAAkB,KAAK;EACpCC,gBAAgB,GAA6C,IAAI;EAEjEC,aAAa,GAAW,CAAC;EACzBC,iBAAiB,GAAkB,IAAI;EACvCC,cAAc,GAAkB,IAAI;EACpCC,qBAAqB,GAAY,IAAI;EACrCC,cAAc,GAAW,GAAG;EAC5BC,kBAAkB,GAAkB,IAAI;EAExCC,WAAW,GAAQ,IAAI;EAE/BC,IAAIA,CAACC,MAAsB,EAAEC,aAA6B,EAAQ;IAChE,IAAI,CAACD,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACC,aAAa,GAAGA,aAAa;IAClC,IAAI,CAACC,oB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