@zappar/zappar-cv 3.0.0-alpha.3 → 3.0.0-alpha.4
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 +2 -2
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/worker-server.js +23 -2
- package/lib/zappar-cv.wasm +0 -0
- package/package.json +1 -1
- package/umd/56.zappar-cv.js +1 -1
- package/umd/{86a9fb85b3e74cca3306.wasm → ab9c9962bfa90d9d8629.wasm} +0 -0
- package/umd/zappar-cv.js +1 -1
- package/umd/zappar-cv.worker.js +1 -1
package/README.md
CHANGED
|
@@ -18,8 +18,8 @@ npm i @zappar/zappar-cv
|
|
|
18
18
|
|
|
19
19
|
You can use our CDN from within your HTML:
|
|
20
20
|
```
|
|
21
|
-
<script src="https://libs.zappar.com/zappar-cv/3.0.0-alpha.
|
|
21
|
+
<script src="https://libs.zappar.com/zappar-cv/3.0.0-alpha.4/zappar-cv.js"></script>
|
|
22
22
|
```
|
|
23
23
|
|
|
24
24
|
Or you can download and host our standalone JavaScript bundle:
|
|
25
|
-
[https://libs.zappar.com/zappar-cv/3.0.0-alpha.
|
|
25
|
+
[https://libs.zappar.com/zappar-cv/3.0.0-alpha.4/zappar-cv.zip](https://libs.zappar.com/zappar-cv/3.0.0-alpha.4/zappar-cv.zip)
|
package/lib/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "3.0.0-alpha.
|
|
1
|
+
export declare const VERSION = "3.0.0-alpha.4";
|
package/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "3.0.0-alpha.
|
|
1
|
+
export const VERSION = "3.0.0-alpha.4";
|
package/lib/worker-server.js
CHANGED
|
@@ -129,13 +129,22 @@ export function launchWorkerServer(wasmUrl) {
|
|
|
129
129
|
function consumeStream(mod, r, stream, p, userFacing, server, source) {
|
|
130
130
|
return __awaiter(this, void 0, void 0, function* () {
|
|
131
131
|
while (true) {
|
|
132
|
+
let reader;
|
|
133
|
+
try {
|
|
134
|
+
reader = yield stream.getReader();
|
|
135
|
+
}
|
|
136
|
+
catch (err) {
|
|
137
|
+
console.log("Error getting reader", err);
|
|
138
|
+
yield delay(1000);
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
132
141
|
try {
|
|
133
|
-
const reader = yield stream.getReader();
|
|
134
142
|
yield consumeReader(mod, r, reader, p, userFacing, server, source);
|
|
135
143
|
}
|
|
136
144
|
catch (err) {
|
|
137
145
|
console.log("Consuming reader error", err);
|
|
138
146
|
}
|
|
147
|
+
reader.releaseLock();
|
|
139
148
|
yield delay(1000);
|
|
140
149
|
}
|
|
141
150
|
});
|
|
@@ -143,12 +152,24 @@ function consumeStream(mod, r, stream, p, userFacing, server, source) {
|
|
|
143
152
|
let streamDataBufferPointer = 0;
|
|
144
153
|
let streamDataBufferLength = 0;
|
|
145
154
|
let tokenId = 1;
|
|
155
|
+
function getFrameOrTimeout(reader) {
|
|
156
|
+
return new Promise((resolve, reject) => {
|
|
157
|
+
const token = setTimeout(() => {
|
|
158
|
+
console.log('Frame timeout');
|
|
159
|
+
reject();
|
|
160
|
+
}, 2000);
|
|
161
|
+
reader.read().then(result => {
|
|
162
|
+
clearTimeout(token);
|
|
163
|
+
resolve(result);
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
}
|
|
146
167
|
const cameraToDeviceTransform = mat4.create();
|
|
147
168
|
const cameraModel = new Float32Array([300, 300, 160, 120, 0, 0]);
|
|
148
169
|
function consumeReader(mod, r, reader, p, userFacing, server, source) {
|
|
149
170
|
return __awaiter(this, void 0, void 0, function* () {
|
|
150
171
|
while (true) {
|
|
151
|
-
let result = yield reader
|
|
172
|
+
let result = yield getFrameOrTimeout(reader);
|
|
152
173
|
if (result.done) {
|
|
153
174
|
console.log("Stream done");
|
|
154
175
|
return;
|
package/lib/zappar-cv.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED