@roboflow/inference-sdk 0.1.11 → 0.1.13
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/index.es.js +111 -109
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/inference-api.d.ts +4 -1
- package/dist/inference-api.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,24 +1,26 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var l = (r, e, t) =>
|
|
4
|
-
var
|
|
5
|
-
const j = typeof process < "u" && ((
|
|
6
|
-
"https://serverless.roboflow.com"
|
|
1
|
+
var q = Object.defineProperty;
|
|
2
|
+
var K = (r, e, t) => e in r ? q(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var l = (r, e, t) => K(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
var I;
|
|
5
|
+
const j = typeof process < "u" && ((I = process.env) != null && I.RF_API_BASE_URL) ? process.env.RF_API_BASE_URL : "https://api.roboflow.com", V = [
|
|
6
|
+
"https://serverless.roboflow.com",
|
|
7
|
+
"https://serverless.roboflow.one"
|
|
7
8
|
];
|
|
8
9
|
class b {
|
|
9
10
|
/**
|
|
10
11
|
* @private
|
|
11
12
|
* Use InferenceHTTPClient.init() instead
|
|
12
13
|
*/
|
|
13
|
-
constructor(e, t = "https://serverless.roboflow.com") {
|
|
14
|
+
constructor(e, t = "https://serverless.roboflow.com", n = j) {
|
|
14
15
|
l(this, "apiKey");
|
|
15
16
|
l(this, "serverUrl");
|
|
16
|
-
this
|
|
17
|
+
l(this, "apiBaseUrl");
|
|
18
|
+
this.apiKey = e, this.serverUrl = t, this.apiBaseUrl = n;
|
|
17
19
|
}
|
|
18
|
-
static init({ apiKey: e, serverUrl: t }) {
|
|
20
|
+
static init({ apiKey: e, serverUrl: t, apiBaseUrl: n }) {
|
|
19
21
|
if (!e)
|
|
20
22
|
throw new Error("apiKey is required");
|
|
21
|
-
return new b(e, t);
|
|
23
|
+
return new b(e, t, n);
|
|
22
24
|
}
|
|
23
25
|
/**
|
|
24
26
|
* Initialize a WebRTC worker pipeline
|
|
@@ -49,15 +51,15 @@ class b {
|
|
|
49
51
|
offer: e,
|
|
50
52
|
workflowSpec: t,
|
|
51
53
|
workspaceName: n,
|
|
52
|
-
workflowId:
|
|
53
|
-
config:
|
|
54
|
+
workflowId: a,
|
|
55
|
+
config: o = {}
|
|
54
56
|
}) {
|
|
55
57
|
if (!e || !e.sdp || !e.type)
|
|
56
58
|
throw new Error("offer with sdp and type is required");
|
|
57
|
-
const
|
|
58
|
-
if (!
|
|
59
|
+
const i = !!t, f = !!(n && a);
|
|
60
|
+
if (!i && !f)
|
|
59
61
|
throw new Error("Either workflowSpec OR (workspaceName + workflowId) is required");
|
|
60
|
-
if (
|
|
62
|
+
if (i && f)
|
|
61
63
|
throw new Error("Provide either workflowSpec OR (workspaceName + workflowId), not both");
|
|
62
64
|
const {
|
|
63
65
|
imageInputName: d = "image",
|
|
@@ -71,7 +73,7 @@ class b {
|
|
|
71
73
|
requestedRegion: C,
|
|
72
74
|
realtimeProcessing: E = !0,
|
|
73
75
|
rtspUrl: R
|
|
74
|
-
} =
|
|
76
|
+
} = o, v = {
|
|
75
77
|
type: "WorkflowConfiguration",
|
|
76
78
|
image_input_name: d,
|
|
77
79
|
workflows_parameters: S,
|
|
@@ -79,7 +81,7 @@ class b {
|
|
|
79
81
|
cancel_thread_pool_tasks_on_exit: !0,
|
|
80
82
|
video_metadata_input_name: "video_metadata"
|
|
81
83
|
};
|
|
82
|
-
|
|
84
|
+
i ? v.workflow_specification = t : (v.workspace_name = n, v.workflow_id = a);
|
|
83
85
|
const m = {
|
|
84
86
|
workflow_configuration: v,
|
|
85
87
|
api_key: this.apiKey,
|
|
@@ -136,7 +138,7 @@ class b {
|
|
|
136
138
|
return null;
|
|
137
139
|
try {
|
|
138
140
|
const e = await fetch(
|
|
139
|
-
`${
|
|
141
|
+
`${this.apiBaseUrl}/webrtc_turn_config?api_key=${this.apiKey}`,
|
|
140
142
|
{
|
|
141
143
|
method: "GET",
|
|
142
144
|
headers: { "Content-Type": "application/json" }
|
|
@@ -154,10 +156,10 @@ class b {
|
|
|
154
156
|
n = [t];
|
|
155
157
|
else
|
|
156
158
|
return console.warn("[RFWebRTC] Invalid TURN config format, using defaults"), null;
|
|
157
|
-
return n.map((
|
|
158
|
-
urls: Array.isArray(
|
|
159
|
-
username:
|
|
160
|
-
credential:
|
|
159
|
+
return n.map((o) => ({
|
|
160
|
+
urls: Array.isArray(o.urls) ? o.urls : [o.urls],
|
|
161
|
+
username: o.username,
|
|
162
|
+
credential: o.credential
|
|
161
163
|
}));
|
|
162
164
|
} catch (e) {
|
|
163
165
|
return console.warn("[RFWebRTC] Error fetching TURN config:", e), null;
|
|
@@ -184,35 +186,35 @@ const ie = {
|
|
|
184
186
|
* ```
|
|
185
187
|
*/
|
|
186
188
|
withApiKey(r, e = {}) {
|
|
187
|
-
const { serverUrl: t } = e;
|
|
189
|
+
const { serverUrl: t, apiBaseUrl: n } = e;
|
|
188
190
|
typeof window < "u" && console.warn(
|
|
189
191
|
"[Security Warning] Using API key directly in browser will expose it. Use connectors.withProxyUrl() for production. See: https://docs.roboflow.com/api-reference/authentication#securing-your-api-key"
|
|
190
192
|
);
|
|
191
|
-
const
|
|
193
|
+
const a = b.init({ apiKey: r, serverUrl: t, apiBaseUrl: n });
|
|
192
194
|
return {
|
|
193
|
-
connectWrtc: async (
|
|
194
|
-
offer:
|
|
195
|
-
workflowSpec:
|
|
196
|
-
workspaceName:
|
|
197
|
-
workflowId:
|
|
195
|
+
connectWrtc: async (o, i) => (console.debug("wrtcParams", i), await a.initializeWebrtcWorker({
|
|
196
|
+
offer: o,
|
|
197
|
+
workflowSpec: i.workflowSpec,
|
|
198
|
+
workspaceName: i.workspaceName,
|
|
199
|
+
workflowId: i.workflowId,
|
|
198
200
|
config: {
|
|
199
|
-
imageInputName:
|
|
200
|
-
streamOutputNames:
|
|
201
|
-
dataOutputNames:
|
|
202
|
-
threadPoolWorkers:
|
|
203
|
-
workflowsParameters:
|
|
204
|
-
iceServers:
|
|
205
|
-
processingTimeout:
|
|
206
|
-
requestedPlan:
|
|
207
|
-
requestedRegion:
|
|
208
|
-
realtimeProcessing:
|
|
209
|
-
rtspUrl:
|
|
201
|
+
imageInputName: i.imageInputName,
|
|
202
|
+
streamOutputNames: i.streamOutputNames,
|
|
203
|
+
dataOutputNames: i.dataOutputNames,
|
|
204
|
+
threadPoolWorkers: i.threadPoolWorkers,
|
|
205
|
+
workflowsParameters: i.workflowsParameters,
|
|
206
|
+
iceServers: i.iceServers,
|
|
207
|
+
processingTimeout: i.processingTimeout,
|
|
208
|
+
requestedPlan: i.requestedPlan,
|
|
209
|
+
requestedRegion: i.requestedRegion,
|
|
210
|
+
realtimeProcessing: i.realtimeProcessing,
|
|
211
|
+
rtspUrl: i.rtspUrl
|
|
210
212
|
}
|
|
211
213
|
})),
|
|
212
214
|
/**
|
|
213
215
|
* Fetch TURN server configuration for improved WebRTC connectivity
|
|
214
216
|
*/
|
|
215
|
-
getIceServers: async () => await
|
|
217
|
+
getIceServers: async () => await a.fetchTurnConfig(),
|
|
216
218
|
// Store apiKey for cleanup
|
|
217
219
|
_apiKey: r,
|
|
218
220
|
_serverUrl: t
|
|
@@ -284,20 +286,20 @@ const ie = {
|
|
|
284
286
|
withProxyUrl(r, e = {}) {
|
|
285
287
|
const { turnConfigUrl: t } = e;
|
|
286
288
|
return {
|
|
287
|
-
connectWrtc: async (n,
|
|
288
|
-
const
|
|
289
|
+
connectWrtc: async (n, a) => {
|
|
290
|
+
const o = await fetch(r, {
|
|
289
291
|
method: "POST",
|
|
290
292
|
headers: { "Content-Type": "application/json" },
|
|
291
293
|
body: JSON.stringify({
|
|
292
294
|
offer: n,
|
|
293
|
-
wrtcParams:
|
|
295
|
+
wrtcParams: a
|
|
294
296
|
})
|
|
295
297
|
});
|
|
296
|
-
if (!
|
|
297
|
-
const
|
|
298
|
-
throw new Error(`Proxy request failed (${
|
|
298
|
+
if (!o.ok) {
|
|
299
|
+
const i = await o.text().catch(() => "");
|
|
300
|
+
throw new Error(`Proxy request failed (${o.status}): ${i}`);
|
|
299
301
|
}
|
|
300
|
-
return await
|
|
302
|
+
return await o.json();
|
|
301
303
|
},
|
|
302
304
|
/**
|
|
303
305
|
* Fetch TURN server configuration from the proxy backend
|
|
@@ -339,7 +341,7 @@ const oe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
339
341
|
function H(r) {
|
|
340
342
|
return new Promise((e) => setTimeout(e, r));
|
|
341
343
|
}
|
|
342
|
-
class
|
|
344
|
+
class D {
|
|
343
345
|
constructor(e, t) {
|
|
344
346
|
l(this, "file");
|
|
345
347
|
l(this, "channel");
|
|
@@ -365,37 +367,37 @@ class N {
|
|
|
365
367
|
throw new Error("Upload cancelled");
|
|
366
368
|
if (this.channel.readyState !== "open")
|
|
367
369
|
throw new Error("Video upload interrupted");
|
|
368
|
-
const
|
|
370
|
+
const a = n * k, o = Math.min(a + k, t), i = this.file.slice(a, o), f = new Uint8Array(await i.arrayBuffer()), d = new ArrayBuffer(8 + f.length), c = new DataView(d);
|
|
369
371
|
for (c.setUint32(0, n, !0), c.setUint32(4, this.totalChunks, !0), new Uint8Array(d, 8).set(f); this.channel.bufferedAmount > M; ) {
|
|
370
372
|
if (this.channel.readyState !== "open")
|
|
371
373
|
throw new Error("Video upload interrupted");
|
|
372
374
|
await H(z);
|
|
373
375
|
}
|
|
374
|
-
this.channel.send(d), e && e(
|
|
376
|
+
this.channel.send(d), e && e(o, t);
|
|
375
377
|
}
|
|
376
378
|
}
|
|
377
379
|
}
|
|
378
380
|
const J = 12;
|
|
379
|
-
class
|
|
381
|
+
class N {
|
|
380
382
|
constructor() {
|
|
381
383
|
l(this, "pendingFrames", /* @__PURE__ */ new Map());
|
|
382
384
|
}
|
|
383
385
|
/**
|
|
384
386
|
* Process an incoming chunk and return the complete message if all chunks received
|
|
385
387
|
*/
|
|
386
|
-
processChunk(e, t, n,
|
|
388
|
+
processChunk(e, t, n, a) {
|
|
387
389
|
if (n === 1)
|
|
388
|
-
return
|
|
390
|
+
return a;
|
|
389
391
|
this.pendingFrames.has(e) || this.pendingFrames.set(e, {
|
|
390
392
|
chunks: /* @__PURE__ */ new Map(),
|
|
391
393
|
totalChunks: n
|
|
392
394
|
});
|
|
393
|
-
const
|
|
394
|
-
if (
|
|
395
|
-
const
|
|
395
|
+
const o = this.pendingFrames.get(e);
|
|
396
|
+
if (o.chunks.set(t, a), o.chunks.size === n) {
|
|
397
|
+
const i = Array.from(o.chunks.values()).reduce((c, s) => c + s.length, 0), f = new Uint8Array(i);
|
|
396
398
|
let d = 0;
|
|
397
399
|
for (let c = 0; c < n; c++) {
|
|
398
|
-
const s =
|
|
400
|
+
const s = o.chunks.get(c);
|
|
399
401
|
f.set(s, d), d += s.length;
|
|
400
402
|
}
|
|
401
403
|
return this.pendingFrames.delete(e), f;
|
|
@@ -410,27 +412,27 @@ class D {
|
|
|
410
412
|
}
|
|
411
413
|
}
|
|
412
414
|
function A(r) {
|
|
413
|
-
const e = new DataView(r), t = e.getUint32(0, !0), n = e.getUint32(4, !0),
|
|
414
|
-
return { frameId: t, chunkIndex: n, totalChunks:
|
|
415
|
+
const e = new DataView(r), t = e.getUint32(0, !0), n = e.getUint32(4, !0), a = e.getUint32(8, !0), o = new Uint8Array(r, J);
|
|
416
|
+
return { frameId: t, chunkIndex: n, totalChunks: a, payload: o };
|
|
415
417
|
}
|
|
416
418
|
async function G(r, e = 6e3) {
|
|
417
419
|
if (r.iceGatheringState === "complete") return;
|
|
418
420
|
let t = !1;
|
|
419
|
-
const n = (
|
|
420
|
-
|
|
421
|
+
const n = (a) => {
|
|
422
|
+
a.candidate && a.candidate.type === "srflx" && (t = !0);
|
|
421
423
|
};
|
|
422
424
|
r.addEventListener("icecandidate", n);
|
|
423
425
|
try {
|
|
424
426
|
await Promise.race([
|
|
425
|
-
new Promise((
|
|
426
|
-
const
|
|
427
|
-
r.iceGatheringState === "complete" && (r.removeEventListener("icegatheringstatechange",
|
|
427
|
+
new Promise((a) => {
|
|
428
|
+
const o = () => {
|
|
429
|
+
r.iceGatheringState === "complete" && (r.removeEventListener("icegatheringstatechange", o), a());
|
|
428
430
|
};
|
|
429
|
-
r.addEventListener("icegatheringstatechange",
|
|
431
|
+
r.addEventListener("icegatheringstatechange", o);
|
|
430
432
|
}),
|
|
431
|
-
new Promise((
|
|
433
|
+
new Promise((a, o) => {
|
|
432
434
|
setTimeout(() => {
|
|
433
|
-
t ?
|
|
435
|
+
t ? a() : (console.error("[ICE] timeout with NO srflx candidate! Connection may fail."), o(new Error("ICE gathering timeout without srflx candidate")));
|
|
434
436
|
}, e);
|
|
435
437
|
})
|
|
436
438
|
]);
|
|
@@ -448,13 +450,13 @@ function Z(r) {
|
|
|
448
450
|
const Q = [
|
|
449
451
|
{ urls: ["stun:stun.l.google.com:19302"] }
|
|
450
452
|
];
|
|
451
|
-
async function X(r, e, t, n,
|
|
453
|
+
async function X(r, e, t, n, a) {
|
|
452
454
|
if ([!!r, !!e, !!n].filter(Boolean).length !== 1)
|
|
453
455
|
throw new Error("Exactly one of localStream, file, or rtspUrl must be provided");
|
|
454
456
|
const c = t ?? Q, s = new RTCPeerConnection({
|
|
455
457
|
iceServers: c
|
|
456
458
|
});
|
|
457
|
-
|
|
459
|
+
a != null && a.onPeerConnectionCreated && await a.onPeerConnectionCreated(s);
|
|
458
460
|
try {
|
|
459
461
|
s.addTransceiver("video", { direction: "recvonly" });
|
|
460
462
|
} catch (h) {
|
|
@@ -463,7 +465,7 @@ async function X(r, e, t, n, i) {
|
|
|
463
465
|
if (r)
|
|
464
466
|
for (const h of r.getVideoTracks()) {
|
|
465
467
|
const C = s.addTrack(h, r);
|
|
466
|
-
|
|
468
|
+
a != null && a.onTrackAdded && await a.onTrackAdded(h, C, s);
|
|
467
469
|
}
|
|
468
470
|
const y = Z(s), S = s.createDataChannel("inference", {
|
|
469
471
|
ordered: !0
|
|
@@ -471,8 +473,8 @@ async function X(r, e, t, n, i) {
|
|
|
471
473
|
let p;
|
|
472
474
|
e && (p = s.createDataChannel("video_upload"));
|
|
473
475
|
let u = await s.createOffer();
|
|
474
|
-
if (
|
|
475
|
-
const h = await
|
|
476
|
+
if (a != null && a.onOfferCreated) {
|
|
477
|
+
const h = await a.onOfferCreated(u);
|
|
476
478
|
h && (u = h);
|
|
477
479
|
}
|
|
478
480
|
return await s.setLocalDescription(u), await G(s), {
|
|
@@ -500,19 +502,19 @@ function ee(r, e = 3e4) {
|
|
|
500
502
|
t();
|
|
501
503
|
return;
|
|
502
504
|
}
|
|
503
|
-
const
|
|
504
|
-
r.removeEventListener("open",
|
|
505
|
-
},
|
|
506
|
-
r.removeEventListener("open",
|
|
507
|
-
},
|
|
508
|
-
r.removeEventListener("open",
|
|
505
|
+
const a = () => {
|
|
506
|
+
r.removeEventListener("open", a), r.removeEventListener("error", o), clearTimeout(i), t();
|
|
507
|
+
}, o = () => {
|
|
508
|
+
r.removeEventListener("open", a), r.removeEventListener("error", o), clearTimeout(i), n(new Error("Datachannel error"));
|
|
509
|
+
}, i = setTimeout(() => {
|
|
510
|
+
r.removeEventListener("open", a), r.removeEventListener("error", o), n(new Error("Datachannel open timeout"));
|
|
509
511
|
}, e);
|
|
510
|
-
r.addEventListener("open",
|
|
512
|
+
r.addEventListener("open", a), r.addEventListener("error", o);
|
|
511
513
|
});
|
|
512
514
|
}
|
|
513
515
|
class x {
|
|
514
516
|
/** @private */
|
|
515
|
-
constructor(e, t, n,
|
|
517
|
+
constructor(e, t, n, a, o, i) {
|
|
516
518
|
/**
|
|
517
519
|
* The underlying RTCPeerConnection.
|
|
518
520
|
* Exposed for advanced use cases like getting stats or accessing senders.
|
|
@@ -536,8 +538,8 @@ class x {
|
|
|
536
538
|
l(this, "uploadChannel");
|
|
537
539
|
l(this, "uploader");
|
|
538
540
|
l(this, "onComplete");
|
|
539
|
-
this.peerConnection = e, this._localStream =
|
|
540
|
-
const f =
|
|
541
|
+
this.peerConnection = e, this._localStream = i == null ? void 0 : i.localStream, this.remoteStreamPromise = t, this.pipelineId = n, this.apiKey = a, this.dataChannel = o, this.reassembler = new N(), this.ackPacingEnabled = (i == null ? void 0 : i.ackPacingEnabled) === !0, this.uploadChannel = i == null ? void 0 : i.uploadChannel, this.onComplete = i == null ? void 0 : i.onComplete, this.dataChannel.binaryType = "arraybuffer";
|
|
542
|
+
const f = i == null ? void 0 : i.onData;
|
|
541
543
|
f && (this.dataChannel.addEventListener("message", (d) => {
|
|
542
544
|
try {
|
|
543
545
|
if (d.data instanceof ArrayBuffer) {
|
|
@@ -642,7 +644,7 @@ class x {
|
|
|
642
644
|
async startUpload(e, t) {
|
|
643
645
|
if (!this.uploadChannel)
|
|
644
646
|
throw new Error("No upload channel available. This connection was not created for file uploads.");
|
|
645
|
-
await ee(this.uploadChannel), this.uploader = new
|
|
647
|
+
await ee(this.uploadChannel), this.uploader = new D(e, this.uploadChannel), await this.uploader.upload(t);
|
|
646
648
|
}
|
|
647
649
|
/**
|
|
648
650
|
* Cancel any ongoing file upload
|
|
@@ -708,9 +710,9 @@ async function F({
|
|
|
708
710
|
rtspUrl: e,
|
|
709
711
|
connector: t,
|
|
710
712
|
wrtcParams: n,
|
|
711
|
-
onData:
|
|
712
|
-
onComplete:
|
|
713
|
-
onFileUploadProgress:
|
|
713
|
+
onData: a,
|
|
714
|
+
onComplete: o,
|
|
715
|
+
onFileUploadProgress: i,
|
|
714
716
|
options: f = {},
|
|
715
717
|
hooks: d
|
|
716
718
|
}) {
|
|
@@ -744,15 +746,15 @@ async function F({
|
|
|
744
746
|
if (!(w != null && w.sdp) || !(w != null && w.type))
|
|
745
747
|
throw console.error("[RFWebRTC] Invalid answer from server:", m), new Error("connector.connectWrtc must return answer with sdp and type");
|
|
746
748
|
const U = ((W = m == null ? void 0 : m.context) == null ? void 0 : W.pipeline_id) || null;
|
|
747
|
-
await u.setRemoteDescription(w), await new Promise((g,
|
|
749
|
+
await u.setRemoteDescription(w), await new Promise((g, L) => {
|
|
748
750
|
const _ = () => {
|
|
749
|
-
u.connectionState === "connected" ? (u.removeEventListener("connectionstatechange", _), g()) : u.connectionState === "failed" && (u.removeEventListener("connectionstatechange", _),
|
|
751
|
+
u.connectionState === "connected" ? (u.removeEventListener("connectionstatechange", _), g()) : u.connectionState === "failed" && (u.removeEventListener("connectionstatechange", _), L(new Error("WebRTC connection failed")));
|
|
750
752
|
};
|
|
751
753
|
u.addEventListener("connectionstatechange", _), _(), setTimeout(() => {
|
|
752
|
-
u.removeEventListener("connectionstatechange", _),
|
|
754
|
+
u.removeEventListener("connectionstatechange", _), L(new Error("WebRTC connection timeout after 30s"));
|
|
753
755
|
}, 3e4);
|
|
754
756
|
}), y && f.disableInputStreamDownscaling !== !1 && await Y(u);
|
|
755
|
-
const T = t._apiKey || null,
|
|
757
|
+
const T = t._apiKey || null, B = v.realtimeProcessing === !1, P = new x(
|
|
756
758
|
u,
|
|
757
759
|
C,
|
|
758
760
|
U,
|
|
@@ -761,12 +763,12 @@ async function F({
|
|
|
761
763
|
{
|
|
762
764
|
localStream: y,
|
|
763
765
|
uploadChannel: R,
|
|
764
|
-
onData:
|
|
765
|
-
onComplete:
|
|
766
|
-
ackPacingEnabled:
|
|
766
|
+
onData: a,
|
|
767
|
+
onComplete: o,
|
|
768
|
+
ackPacingEnabled: B
|
|
767
769
|
}
|
|
768
770
|
);
|
|
769
|
-
return S && R && P.startUpload(S,
|
|
771
|
+
return S && R && P.startUpload(S, i).catch((g) => {
|
|
770
772
|
console.error("[RFWebRTC] Upload error:", g);
|
|
771
773
|
}), P;
|
|
772
774
|
}
|
|
@@ -775,8 +777,8 @@ async function te({
|
|
|
775
777
|
connector: e,
|
|
776
778
|
wrtcParams: t,
|
|
777
779
|
onData: n,
|
|
778
|
-
options:
|
|
779
|
-
hooks:
|
|
780
|
+
options: a = {},
|
|
781
|
+
hooks: o
|
|
780
782
|
}) {
|
|
781
783
|
if (r instanceof File)
|
|
782
784
|
throw new Error("useStream requires a MediaStream. Use useVideoFile for File uploads.");
|
|
@@ -785,8 +787,8 @@ async function te({
|
|
|
785
787
|
connector: e,
|
|
786
788
|
wrtcParams: t,
|
|
787
789
|
onData: n,
|
|
788
|
-
options:
|
|
789
|
-
hooks:
|
|
790
|
+
options: a,
|
|
791
|
+
hooks: o
|
|
790
792
|
});
|
|
791
793
|
}
|
|
792
794
|
async function re({
|
|
@@ -794,9 +796,9 @@ async function re({
|
|
|
794
796
|
connector: e,
|
|
795
797
|
wrtcParams: t,
|
|
796
798
|
onData: n,
|
|
797
|
-
onUploadProgress:
|
|
798
|
-
onComplete:
|
|
799
|
-
hooks:
|
|
799
|
+
onUploadProgress: a,
|
|
800
|
+
onComplete: o,
|
|
801
|
+
hooks: i
|
|
800
802
|
}) {
|
|
801
803
|
return F({
|
|
802
804
|
source: r,
|
|
@@ -806,9 +808,9 @@ async function re({
|
|
|
806
808
|
realtimeProcessing: t.realtimeProcessing ?? !0
|
|
807
809
|
},
|
|
808
810
|
onData: n,
|
|
809
|
-
onComplete:
|
|
810
|
-
onFileUploadProgress:
|
|
811
|
-
hooks:
|
|
811
|
+
onComplete: o,
|
|
812
|
+
onFileUploadProgress: a,
|
|
813
|
+
hooks: i
|
|
812
814
|
});
|
|
813
815
|
}
|
|
814
816
|
async function ne({
|
|
@@ -816,7 +818,7 @@ async function ne({
|
|
|
816
818
|
connector: e,
|
|
817
819
|
wrtcParams: t,
|
|
818
820
|
onData: n,
|
|
819
|
-
hooks:
|
|
821
|
+
hooks: a
|
|
820
822
|
}) {
|
|
821
823
|
if (!r.startsWith("rtsp://") && !r.startsWith("rtsps://"))
|
|
822
824
|
throw new Error("Invalid RTSP URL: must start with rtsp:// or rtsps://");
|
|
@@ -825,13 +827,13 @@ async function ne({
|
|
|
825
827
|
connector: e,
|
|
826
828
|
wrtcParams: t,
|
|
827
829
|
onData: n,
|
|
828
|
-
hooks:
|
|
830
|
+
hooks: a
|
|
829
831
|
});
|
|
830
832
|
}
|
|
831
833
|
const se = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
832
834
|
__proto__: null,
|
|
833
|
-
ChunkReassembler:
|
|
834
|
-
FileUploader:
|
|
835
|
+
ChunkReassembler: N,
|
|
836
|
+
FileUploader: D,
|
|
835
837
|
RFWebRTCConnection: x,
|
|
836
838
|
parseBinaryHeader: A,
|
|
837
839
|
useRtspStream: ne,
|