@srsergio/taptapp-ar 1.0.56 → 1.0.59

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.
@@ -103,9 +103,13 @@ export class OfflineCompiler {
103
103
  });
104
104
  return Promise.all(wrappedPromises);
105
105
  }
106
- // Fallback or non-worker implementation omitted for brevity,
107
- // focus is on the optimized worker path.
108
- throw new Error("Optimized Single-Pass compilation requires Workers.");
106
+ // Fallback or non-worker implementation: run match and track sequentially
107
+ const matchingResults = await this._compileMatch(targetImages, (p) => progressCallback(p * 0.5));
108
+ const trackingResults = await this._compileTrack(targetImages, (p) => progressCallback(50 + p * 0.5));
109
+ return targetImages.map((_, i) => ({
110
+ matchingData: matchingResults[i],
111
+ trackingData: trackingResults[i]
112
+ }));
109
113
  }
110
114
  async _compileMatch(targetImages, progressCallback) {
111
115
  const percentPerImage = 100 / targetImages.length;
@@ -3,20 +3,23 @@ export interface ARConfig {
3
3
  targetImageSrc: string;
4
4
  targetTaarSrc: string;
5
5
  videoSrc: string;
6
+ overlaySrc: string;
6
7
  videoWidth: number;
7
8
  videoHeight: number;
8
9
  scale: number;
10
+ overlayType: "video" | "image";
9
11
  }
10
12
  export interface ARDataItem {
11
13
  id: string;
12
- type: "photos" | "videoNative" | "ar";
14
+ type: "photos" | "videoNative" | "ar" | "imageOverlay";
13
15
  images?: {
14
16
  image: string;
15
17
  fileId: string;
16
18
  }[];
17
19
  url?: string;
20
+ fileId?: string;
18
21
  scale?: number;
19
22
  width?: number;
20
23
  height?: number;
21
24
  }
22
- export declare function mapDataToPropsConfig(data: any[]): ARConfig;
25
+ export declare function mapDataToPropsConfig(data: ARDataItem[]): ARConfig;
@@ -1,14 +1,16 @@
1
1
  export function mapDataToPropsConfig(data) {
2
2
  const photos = data.find((item) => item.type === "photos");
3
- const video = data.find((item) => item.type === "videoNative");
3
+ const overlay = data.find((item) => item.type === "videoNative" || item.type === "imageOverlay");
4
4
  const ar = data.find((item) => item.type === "ar");
5
5
  return {
6
6
  cardId: photos?.id || "",
7
7
  targetImageSrc: photos?.images?.[0]?.image || "",
8
8
  targetTaarSrc: ar?.url || "",
9
- videoSrc: video?.url || "",
10
- videoWidth: video?.width || 0,
11
- videoHeight: video?.height || 0,
12
- scale: video?.scale || 1,
9
+ videoSrc: overlay?.url || "",
10
+ overlaySrc: overlay?.url || "",
11
+ videoWidth: overlay?.width || 0,
12
+ videoHeight: overlay?.height || 0,
13
+ scale: overlay?.scale || 1,
14
+ overlayType: overlay?.type === "videoNative" ? "video" : "image",
13
15
  };
14
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@srsergio/taptapp-ar",
3
- "version": "1.0.56",
3
+ "version": "1.0.59",
4
4
  "author": "Sergio Lazaro <srsergiolazaro@gmail.com>",
5
5
  "license": "GPL-3.0",
6
6
  "description": "Ultra-fast, lightweight Augmented Reality Image Tracking SDK for the web. Features an optimized offline compiler, React components, and compatibility with Three.js/A-Frame. No heavy ML frameworks required.",
@@ -126,9 +126,14 @@ export class OfflineCompiler {
126
126
  return Promise.all(wrappedPromises);
127
127
  }
128
128
 
129
- // Fallback or non-worker implementation omitted for brevity,
130
- // focus is on the optimized worker path.
131
- throw new Error("Optimized Single-Pass compilation requires Workers.");
129
+ // Fallback or non-worker implementation: run match and track sequentially
130
+ const matchingResults = await this._compileMatch(targetImages, (p) => progressCallback(p * 0.5));
131
+ const trackingResults = await this._compileTrack(targetImages, (p) => progressCallback(50 + p * 0.5));
132
+
133
+ return targetImages.map((_, i) => ({
134
+ matchingData: matchingResults[i],
135
+ trackingData: trackingResults[i]
136
+ }));
132
137
  }
133
138
 
134
139
  async _compileMatch(targetImages: any[], progressCallback: (p: number) => void) {
@@ -3,33 +3,38 @@ export interface ARConfig {
3
3
  targetImageSrc: string;
4
4
  targetTaarSrc: string;
5
5
  videoSrc: string;
6
+ overlaySrc: string; // Alias for preloading/compatibility
6
7
  videoWidth: number;
7
8
  videoHeight: number;
8
9
  scale: number;
10
+ overlayType: "video" | "image";
9
11
  }
10
12
 
11
13
  export interface ARDataItem {
12
14
  id: string;
13
- type: "photos" | "videoNative" | "ar";
15
+ type: "photos" | "videoNative" | "ar" | "imageOverlay";
14
16
  images?: { image: string; fileId: string }[];
15
17
  url?: string;
18
+ fileId?: string;
16
19
  scale?: number;
17
20
  width?: number;
18
21
  height?: number;
19
22
  }
20
23
 
21
- export function mapDataToPropsConfig(data: any[]): ARConfig {
24
+ export function mapDataToPropsConfig(data: ARDataItem[]): ARConfig {
22
25
  const photos = data.find((item) => item.type === "photos");
23
- const video = data.find((item) => item.type === "videoNative");
26
+ const overlay = data.find((item) => item.type === "videoNative" || item.type === "imageOverlay");
24
27
  const ar = data.find((item) => item.type === "ar");
25
28
 
26
29
  return {
27
30
  cardId: photos?.id || "",
28
31
  targetImageSrc: photos?.images?.[0]?.image || "",
29
32
  targetTaarSrc: ar?.url || "",
30
- videoSrc: video?.url || "",
31
- videoWidth: video?.width || 0,
32
- videoHeight: video?.height || 0,
33
- scale: video?.scale || 1,
33
+ videoSrc: overlay?.url || "",
34
+ overlaySrc: overlay?.url || "",
35
+ videoWidth: overlay?.width || 0,
36
+ videoHeight: overlay?.height || 0,
37
+ scale: overlay?.scale || 1,
38
+ overlayType: overlay?.type === "videoNative" ? "video" : "image",
34
39
  };
35
40
  }