@eyepop.ai/eyepop 1.11.5 → 1.11.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/dist/eyepop.index.d.mts +6 -5
- package/dist/eyepop.index.d.ts +6 -5
- package/dist/eyepop.index.js +25 -16
- package/dist/eyepop.index.js.map +1 -1
- package/dist/eyepop.index.mjs +25 -16
- package/dist/eyepop.index.mjs.map +1 -1
- package/dist/eyepop.min.js +1 -1
- package/package.json +1 -1
package/dist/eyepop.index.d.mts
CHANGED
|
@@ -18,11 +18,11 @@ interface Box {
|
|
|
18
18
|
readonly bottomRight: Point2d;
|
|
19
19
|
}
|
|
20
20
|
interface Roi {
|
|
21
|
-
readonly points
|
|
22
|
-
readonly boxes
|
|
21
|
+
readonly points?: Point2d[];
|
|
22
|
+
readonly boxes?: Box[];
|
|
23
23
|
}
|
|
24
24
|
interface SourceParams {
|
|
25
|
-
readonly roi
|
|
25
|
+
readonly roi?: Roi;
|
|
26
26
|
}
|
|
27
27
|
interface StreamTime {
|
|
28
28
|
timestamp?: number;
|
|
@@ -455,7 +455,7 @@ declare class WorkerEndpoint extends Endpoint<WorkerEndpoint> {
|
|
|
455
455
|
onIngressEvent(handler: (event: IngressEvent) => void): WorkerEndpoint;
|
|
456
456
|
liveIngress(stream: MediaStream): Promise<LiveMedia>;
|
|
457
457
|
liveEgress(ingressId: string): Promise<LiveMedia>;
|
|
458
|
-
process(source: Source, params?: SourceParams
|
|
458
|
+
process(source: Source, params?: SourceParams): Promise<ResultStream>;
|
|
459
459
|
private startIngressWs;
|
|
460
460
|
private uploadFile;
|
|
461
461
|
private uploadStream;
|
|
@@ -825,7 +825,7 @@ declare class UploadJob extends AbstractJob {
|
|
|
825
825
|
private readonly _mimeType;
|
|
826
826
|
private readonly _needsFullDuplex;
|
|
827
827
|
get [Symbol.toStringTag](): string;
|
|
828
|
-
constructor(stream:
|
|
828
|
+
constructor(stream: ReadableStream<Uint8Array>, mimeType: string, params: SourceParams | undefined, getSession: () => Promise<WorkerSession>, client: HttpClient, requestLogger: Logger);
|
|
829
829
|
protected onEvent(event: StreamEvent): Promise<void>;
|
|
830
830
|
protected startJob(): Promise<Response>;
|
|
831
831
|
}
|
|
@@ -861,6 +861,7 @@ declare abstract class WebrtcBase {
|
|
|
861
861
|
constructor(getSession: () => Promise<WorkerSession>, client: HttpClient, ingressId: string, urlBasePath: string, requestLogger: Logger);
|
|
862
862
|
close(): Promise<void>;
|
|
863
863
|
ingressId(): string;
|
|
864
|
+
protected gresUrl(session: WorkerSession, location?: string | null): URL;
|
|
864
865
|
protected onLocalOffer(offer: RTCSessionDescriptionInit): Promise<WebrtcBase>;
|
|
865
866
|
protected abstract onRemoteAnswer(answer: RTCSessionDescription): Promise<WebrtcBase>;
|
|
866
867
|
protected sendLocalCandidates(candidates: RTCIceCandidate[]): Promise<WebrtcBase>;
|
package/dist/eyepop.index.d.ts
CHANGED
|
@@ -18,11 +18,11 @@ interface Box {
|
|
|
18
18
|
readonly bottomRight: Point2d;
|
|
19
19
|
}
|
|
20
20
|
interface Roi {
|
|
21
|
-
readonly points
|
|
22
|
-
readonly boxes
|
|
21
|
+
readonly points?: Point2d[];
|
|
22
|
+
readonly boxes?: Box[];
|
|
23
23
|
}
|
|
24
24
|
interface SourceParams {
|
|
25
|
-
readonly roi
|
|
25
|
+
readonly roi?: Roi;
|
|
26
26
|
}
|
|
27
27
|
interface StreamTime {
|
|
28
28
|
timestamp?: number;
|
|
@@ -455,7 +455,7 @@ declare class WorkerEndpoint extends Endpoint<WorkerEndpoint> {
|
|
|
455
455
|
onIngressEvent(handler: (event: IngressEvent) => void): WorkerEndpoint;
|
|
456
456
|
liveIngress(stream: MediaStream): Promise<LiveMedia>;
|
|
457
457
|
liveEgress(ingressId: string): Promise<LiveMedia>;
|
|
458
|
-
process(source: Source, params?: SourceParams
|
|
458
|
+
process(source: Source, params?: SourceParams): Promise<ResultStream>;
|
|
459
459
|
private startIngressWs;
|
|
460
460
|
private uploadFile;
|
|
461
461
|
private uploadStream;
|
|
@@ -825,7 +825,7 @@ declare class UploadJob extends AbstractJob {
|
|
|
825
825
|
private readonly _mimeType;
|
|
826
826
|
private readonly _needsFullDuplex;
|
|
827
827
|
get [Symbol.toStringTag](): string;
|
|
828
|
-
constructor(stream:
|
|
828
|
+
constructor(stream: ReadableStream<Uint8Array>, mimeType: string, params: SourceParams | undefined, getSession: () => Promise<WorkerSession>, client: HttpClient, requestLogger: Logger);
|
|
829
829
|
protected onEvent(event: StreamEvent): Promise<void>;
|
|
830
830
|
protected startJob(): Promise<Response>;
|
|
831
831
|
}
|
|
@@ -861,6 +861,7 @@ declare abstract class WebrtcBase {
|
|
|
861
861
|
constructor(getSession: () => Promise<WorkerSession>, client: HttpClient, ingressId: string, urlBasePath: string, requestLogger: Logger);
|
|
862
862
|
close(): Promise<void>;
|
|
863
863
|
ingressId(): string;
|
|
864
|
+
protected gresUrl(session: WorkerSession, location?: string | null): URL;
|
|
864
865
|
protected onLocalOffer(offer: RTCSessionDescriptionInit): Promise<WebrtcBase>;
|
|
865
866
|
protected abstract onRemoteAnswer(answer: RTCSessionDescription): Promise<WebrtcBase>;
|
|
866
867
|
protected sendLocalCandidates(candidates: RTCIceCandidate[]): Promise<WebrtcBase>;
|
package/dist/eyepop.index.js
CHANGED
|
@@ -8987,8 +8987,9 @@ var UploadJob = class extends AbstractJob {
|
|
|
8987
8987
|
const params = JSON.stringify(this._params);
|
|
8988
8988
|
const paramBlob = new Blob([params], { type: "application/json" });
|
|
8989
8989
|
const formData = new FormData();
|
|
8990
|
+
const fileBlob = await new Response(this._uploadStream).blob();
|
|
8990
8991
|
formData.append("params", paramBlob);
|
|
8991
|
-
formData.append("file",
|
|
8992
|
+
formData.append("file", fileBlob);
|
|
8992
8993
|
const headers = {
|
|
8993
8994
|
...session.authenticationHeaders(),
|
|
8994
8995
|
Accept: "application/jsonl"
|
|
@@ -9057,8 +9058,9 @@ var UploadJob = class extends AbstractJob {
|
|
|
9057
9058
|
const params = JSON.stringify(this._params);
|
|
9058
9059
|
const paramBlob = new Blob([params], { type: "application/json" });
|
|
9059
9060
|
const formData = new FormData();
|
|
9061
|
+
const fileBlob = await new Response(this._uploadStream).blob();
|
|
9060
9062
|
formData.append("params", paramBlob);
|
|
9061
|
-
formData.append("file",
|
|
9063
|
+
formData.append("file", fileBlob);
|
|
9062
9064
|
const headers = {
|
|
9063
9065
|
...session.authenticationHeaders(),
|
|
9064
9066
|
Accept: "application/jsonl"
|
|
@@ -9192,6 +9194,21 @@ var WebrtcBase = class _WebrtcBase {
|
|
|
9192
9194
|
ingressId() {
|
|
9193
9195
|
return this._ingressId;
|
|
9194
9196
|
}
|
|
9197
|
+
gresUrl(session, location = null) {
|
|
9198
|
+
let urlPath;
|
|
9199
|
+
if (location) {
|
|
9200
|
+
urlPath = import_path.default.join(this._urlPath, location);
|
|
9201
|
+
} else {
|
|
9202
|
+
urlPath = this._urlPath;
|
|
9203
|
+
}
|
|
9204
|
+
let baseUrl;
|
|
9205
|
+
if (session.baseUrl?.endsWith("/")) {
|
|
9206
|
+
baseUrl = session.baseUrl;
|
|
9207
|
+
} else {
|
|
9208
|
+
baseUrl = session.baseUrl + "/";
|
|
9209
|
+
}
|
|
9210
|
+
return new URL(urlPath, baseUrl);
|
|
9211
|
+
}
|
|
9195
9212
|
async onLocalOffer(offer) {
|
|
9196
9213
|
if (!this._pc) {
|
|
9197
9214
|
throw new Error("onLocalOffer no peer connection");
|
|
@@ -9202,7 +9219,7 @@ var WebrtcBase = class _WebrtcBase {
|
|
|
9202
9219
|
this._offerData = _WebrtcBase.parseOffer(offer.sdp);
|
|
9203
9220
|
await this._pc.setLocalDescription(offer);
|
|
9204
9221
|
const session = await this._getSession();
|
|
9205
|
-
const ingressUrl =
|
|
9222
|
+
const ingressUrl = this.gresUrl(session);
|
|
9206
9223
|
this._requestLogger.debug("before POST: %s", ingressUrl);
|
|
9207
9224
|
const headers = {
|
|
9208
9225
|
...session.authenticationHeaders(),
|
|
@@ -9231,12 +9248,7 @@ var WebrtcBase = class _WebrtcBase {
|
|
|
9231
9248
|
}
|
|
9232
9249
|
let urlPath = void 0;
|
|
9233
9250
|
const session = await this._getSession();
|
|
9234
|
-
|
|
9235
|
-
urlPath = import_path.default.join(this._urlPath, this._location);
|
|
9236
|
-
} else {
|
|
9237
|
-
urlPath = this._urlPath;
|
|
9238
|
-
}
|
|
9239
|
-
const ingressUrl = new URL(urlPath, session.baseUrl);
|
|
9251
|
+
const ingressUrl = this.gresUrl(session, this._location);
|
|
9240
9252
|
this._requestLogger.debug("before PATCH: %s", ingressUrl);
|
|
9241
9253
|
const headers = {
|
|
9242
9254
|
...session.authenticationHeaders(),
|
|
@@ -9418,7 +9430,7 @@ var WebrtcWhip = class extends WebrtcBase {
|
|
|
9418
9430
|
}
|
|
9419
9431
|
async start() {
|
|
9420
9432
|
const session = await this._getSession();
|
|
9421
|
-
const ingressUrl =
|
|
9433
|
+
const ingressUrl = this.gresUrl(session);
|
|
9422
9434
|
this._requestLogger.debug("before GET: %s", ingressUrl);
|
|
9423
9435
|
const response = await this._client.fetch(ingressUrl, {
|
|
9424
9436
|
headers: session.authenticationHeaders(),
|
|
@@ -9519,7 +9531,7 @@ var WebrtcWhep = class extends WebrtcBase {
|
|
|
9519
9531
|
}
|
|
9520
9532
|
async start() {
|
|
9521
9533
|
const session = await this._getSession();
|
|
9522
|
-
const egressUrl =
|
|
9534
|
+
const egressUrl = this.gresUrl(session);
|
|
9523
9535
|
this._requestLogger.debug("before GET: %s", egressUrl);
|
|
9524
9536
|
const response = await this._client.fetch(egressUrl, {
|
|
9525
9537
|
headers: session.authenticationHeaders(),
|
|
@@ -9630,7 +9642,6 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
|
9630
9642
|
}
|
|
9631
9643
|
}
|
|
9632
9644
|
createHttpClient = async () => {
|
|
9633
|
-
console.debug("EyePop: creating HttpClient in browser");
|
|
9634
9645
|
return new BrowserHttpClient();
|
|
9635
9646
|
};
|
|
9636
9647
|
} else if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
|
|
@@ -9646,7 +9657,6 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
|
9646
9657
|
}
|
|
9647
9658
|
}
|
|
9648
9659
|
createHttpClient = async () => {
|
|
9649
|
-
console.debug("EyePop: creating HttpClient in ReactNative");
|
|
9650
9660
|
return new ReactNativeHttpClient();
|
|
9651
9661
|
};
|
|
9652
9662
|
} else {
|
|
@@ -9664,7 +9674,6 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
|
9664
9674
|
}
|
|
9665
9675
|
}
|
|
9666
9676
|
createHttpClient = async () => {
|
|
9667
|
-
console.debug("EyePop: creating HttpClient with undici agent in Node");
|
|
9668
9677
|
const undici = require("undici");
|
|
9669
9678
|
const agent = new undici.Agent({
|
|
9670
9679
|
keepAliveTimeout: 1e4,
|
|
@@ -10319,7 +10328,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10319
10328
|
);
|
|
10320
10329
|
return whep.start();
|
|
10321
10330
|
}
|
|
10322
|
-
async process(source, params
|
|
10331
|
+
async process(source, params) {
|
|
10323
10332
|
if (source.file !== void 0) {
|
|
10324
10333
|
return this.uploadFile(source, params);
|
|
10325
10334
|
} else if (source.stream !== void 0) {
|
|
@@ -10373,7 +10382,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10373
10382
|
try {
|
|
10374
10383
|
this.updateState();
|
|
10375
10384
|
const job = new UploadJob(
|
|
10376
|
-
source.file,
|
|
10385
|
+
source.file.stream(),
|
|
10377
10386
|
source.file.type,
|
|
10378
10387
|
params,
|
|
10379
10388
|
async () => {
|