iidrak-analytics-react 1.2.6 → 1.2.7
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.
package/README.md
CHANGED
|
@@ -164,6 +164,11 @@ If you see this error, it means the native module `react-native-device-info` is
|
|
|
164
164
|
1. Ensure you installed the peer dependency: `npm install react-native-device-info`
|
|
165
165
|
2. Rebuild your native app: `cd android && ./gradlew clean && cd .. && npx react-native run-android`
|
|
166
166
|
|
|
167
|
+
### "Network request failed" on Android
|
|
168
|
+
If your backend is running on HTTP (not HTTPS), Android will block the connection by default.
|
|
169
|
+
1. Create a `network_security_config.xml` in `android/app/src/main/res/xml/` allowing cleartext traffic for your domain/IP.
|
|
170
|
+
2. Or for development, add `android:usesCleartextTraffic="true"` to your `AndroidManifest.xml` `<application>` tag.
|
|
171
|
+
|
|
167
172
|
### "Cannot read property 'MetaStreamProvider' of undefined"
|
|
168
173
|
Ensure you are importing correctly.
|
|
169
174
|
Correct: `import { MetaStreamProvider } from 'iidrak-analytics-react';`
|
|
@@ -46,10 +46,13 @@ class MetaStreamIORecorder {
|
|
|
46
46
|
|
|
47
47
|
// 1. Initialize Session on Python Server
|
|
48
48
|
// Note: We use a separate fetch here because the payload format is different from standard analytics
|
|
49
|
-
|
|
49
|
+
const url = `${this.endpoint}/api/apps/${this.app_id}/sessions`;
|
|
50
|
+
this.logger.log("recorder", `Sending session creation request to: ${url}`);
|
|
51
|
+
await fetch(url, {
|
|
50
52
|
method: 'POST',
|
|
51
53
|
headers: { 'Content-Type': 'application/json' },
|
|
52
54
|
body: JSON.stringify({
|
|
55
|
+
session_id: this.sessionId,
|
|
53
56
|
device_info: {
|
|
54
57
|
width: Dimensions.get('window').width,
|
|
55
58
|
height: Dimensions.get('window').height,
|
|
@@ -58,19 +61,19 @@ class MetaStreamIORecorder {
|
|
|
58
61
|
}
|
|
59
62
|
})
|
|
60
63
|
}).then(async res => {
|
|
64
|
+
this.logger.log("recorder", "Session creation response status: " + res.status);
|
|
61
65
|
if (res.ok) {
|
|
62
66
|
const data = await res.json();
|
|
63
67
|
// Server might return its own ID, but we want to map them.
|
|
64
|
-
// For simplicity, we assume server respects ours or we track the mapping.
|
|
65
|
-
// In this demo, the server generates a timestamp ID. That's fine.
|
|
66
68
|
this.recorderSessionId = data.session_id;
|
|
67
69
|
this.isRecording = true;
|
|
68
70
|
this.startLoop(viewRef);
|
|
71
|
+
this.logger.log("recorder", "Session created successfully with ID: " + this.recorderSessionId);
|
|
69
72
|
} else {
|
|
70
|
-
this.logger.error("recorder", "Failed to start session on recording server");
|
|
73
|
+
this.logger.error("recorder", "Failed to start session on recording server: " + res.status);
|
|
71
74
|
}
|
|
72
|
-
}).catch(
|
|
73
|
-
this.logger.error("recorder", "Connection error to recording server: " +
|
|
75
|
+
}).catch(e => {
|
|
76
|
+
this.logger.error("recorder", "Connection error to recording server: " + e + " to " + url);
|
|
74
77
|
});
|
|
75
78
|
|
|
76
79
|
} catch (err) {
|
|
@@ -158,7 +161,7 @@ class MetaStreamIORecorder {
|
|
|
158
161
|
}
|
|
159
162
|
|
|
160
163
|
try {
|
|
161
|
-
await fetch(`${this.endpoint}/apps/${this.app_id}/sessions/${this.recorderSessionId}/screenshot`, {
|
|
164
|
+
await fetch(`${this.endpoint}/api/apps/${this.app_id}/sessions/${this.recorderSessionId}/screenshot`, {
|
|
162
165
|
method: 'POST',
|
|
163
166
|
body: formData,
|
|
164
167
|
headers: {
|
|
@@ -185,7 +188,7 @@ class MetaStreamIORecorder {
|
|
|
185
188
|
};
|
|
186
189
|
|
|
187
190
|
try {
|
|
188
|
-
fetch(`${this.endpoint}/apps/${this.app_id}/sessions/${this.recorderSessionId}/events`, {
|
|
191
|
+
fetch(`${this.endpoint}/api/apps/${this.app_id}/sessions/${this.recorderSessionId}/events`, {
|
|
189
192
|
method: 'POST',
|
|
190
193
|
headers: { 'Content-Type': 'application/json' },
|
|
191
194
|
body: JSON.stringify([event])
|
|
@@ -9,6 +9,9 @@ export class ConfigConstructorModel {
|
|
|
9
9
|
silentMode = null,
|
|
10
10
|
allowTrackCategories = [],
|
|
11
11
|
appName = null,
|
|
12
|
+
quality = null,
|
|
13
|
+
fps = null,
|
|
14
|
+
recordingEndpoint = null,
|
|
12
15
|
} = {}) {
|
|
13
16
|
this.logging = logging;
|
|
14
17
|
this.loggingLevel = loggingLevel;
|
|
@@ -18,7 +21,11 @@ export class ConfigConstructorModel {
|
|
|
18
21
|
this.sessionLength = sessionLength;
|
|
19
22
|
this.silentMode = silentMode;
|
|
20
23
|
this.allowTrackCategories = allowTrackCategories;
|
|
24
|
+
// correctly assign appName
|
|
21
25
|
this.appName = appName;
|
|
26
|
+
this.quality = quality;
|
|
27
|
+
this.fps = fps;
|
|
28
|
+
this.recordingEndpoint = recordingEndpoint;
|
|
22
29
|
}
|
|
23
30
|
json() {
|
|
24
31
|
return {
|
|
@@ -30,6 +37,10 @@ export class ConfigConstructorModel {
|
|
|
30
37
|
sessionLength: this.sessionLength,
|
|
31
38
|
silentMode: this.silentMode,
|
|
32
39
|
allowTrackCategories: this.allowTrackCategories,
|
|
40
|
+
appName: this.appName,
|
|
41
|
+
quality: this.quality,
|
|
42
|
+
fps: this.fps,
|
|
43
|
+
recordingEndpoint: this.recordingEndpoint,
|
|
33
44
|
};
|
|
34
45
|
}
|
|
35
46
|
}
|