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