@camera.ui/browser 0.1.8 → 0.1.10
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.d.ts +2 -0
- package/dist/index.js +25 -10
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -265,6 +265,7 @@ export declare interface CameraUiContext {
|
|
|
265
265
|
extraProxyQuery: Readonly<Ref<Record<string, string> | undefined>>;
|
|
266
266
|
error: Readonly<Ref<Error | undefined>>;
|
|
267
267
|
wsTransport?: WsTransport;
|
|
268
|
+
iceServers?: Readonly<Ref<RTCIceServer[] | undefined>>;
|
|
268
269
|
on: (event: CameraUiEventType, cb: CameraUiEventCallback) => void;
|
|
269
270
|
off: (event: CameraUiEventType, cb: CameraUiEventCallback) => void;
|
|
270
271
|
}
|
|
@@ -280,6 +281,7 @@ export declare interface CameraUiPluginInput {
|
|
|
280
281
|
bulkTransport?: NatsTransport;
|
|
281
282
|
target: Ref<ConnectionTarget | null>;
|
|
282
283
|
wsTransport?: WsTransport;
|
|
284
|
+
iceServers?: Readonly<Ref<RTCIceServer[] | undefined>>;
|
|
283
285
|
}
|
|
284
286
|
|
|
285
287
|
/* Excluded from this release type: CarbonDioxideInfoProperties */
|
package/dist/index.js
CHANGED
|
@@ -3433,7 +3433,7 @@ function isContext(input) {
|
|
|
3433
3433
|
}
|
|
3434
3434
|
var DOWN_DEBOUNCE_MS = 4e3;
|
|
3435
3435
|
function makeContextFromTransport(input) {
|
|
3436
|
-
const { natsTransport, bulkTransport, target, wsTransport } = input;
|
|
3436
|
+
const { natsTransport, bulkTransport, target, wsTransport, iceServers } = input;
|
|
3437
3437
|
let hasBeenConnected = natsTransport.getClient() !== null;
|
|
3438
3438
|
let lastClient = natsTransport.getClient();
|
|
3439
3439
|
let downTimer = null;
|
|
@@ -3525,6 +3525,7 @@ function makeContextFromTransport(input) {
|
|
|
3525
3525
|
extraProxyQuery,
|
|
3526
3526
|
error: readonly(error),
|
|
3527
3527
|
wsTransport,
|
|
3528
|
+
iceServers,
|
|
3528
3529
|
on,
|
|
3529
3530
|
off
|
|
3530
3531
|
});
|
|
@@ -4307,11 +4308,21 @@ async function playVideo(videoElement) {
|
|
|
4307
4308
|
}
|
|
4308
4309
|
//#endregion
|
|
4309
4310
|
//#region src/streaming/webrtc.ts
|
|
4310
|
-
function
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4311
|
+
function newPeerConnection(iceServers = [...STREAM_CONFIG.WEBRTC.ICE_SERVERS]) {
|
|
4312
|
+
try {
|
|
4313
|
+
return new RTCPeerConnection({
|
|
4314
|
+
bundlePolicy: "max-bundle",
|
|
4315
|
+
iceServers
|
|
4316
|
+
});
|
|
4317
|
+
} catch {
|
|
4318
|
+
return new RTCPeerConnection({
|
|
4319
|
+
bundlePolicy: "max-bundle",
|
|
4320
|
+
iceServers: [...STREAM_CONFIG.WEBRTC.ICE_SERVERS]
|
|
4321
|
+
});
|
|
4322
|
+
}
|
|
4323
|
+
}
|
|
4324
|
+
function createBasePeerConnection(signal, onCandidate, filterUdp, iceServers) {
|
|
4325
|
+
const peerConnection = newPeerConnection(iceServers);
|
|
4315
4326
|
peerConnection.onicecandidate = (ev) => {
|
|
4316
4327
|
if (signal.aborted) return;
|
|
4317
4328
|
if (filterUdp && ev.candidate?.protocol === "udp") return;
|
|
@@ -4354,7 +4365,7 @@ function closePeerConnection(state) {
|
|
|
4354
4365
|
state.isConnected = false;
|
|
4355
4366
|
}
|
|
4356
4367
|
function createWebRTCHandler(options) {
|
|
4357
|
-
const { mode, onConnected, onDisconnected, onFailed, onCandidate, signal } = options;
|
|
4368
|
+
const { mode, iceServers, onConnected, onDisconnected, onFailed, onCandidate, signal } = options;
|
|
4358
4369
|
const state = {
|
|
4359
4370
|
pc: null,
|
|
4360
4371
|
micTransceiver: null,
|
|
@@ -4362,7 +4373,7 @@ function createWebRTCHandler(options) {
|
|
|
4362
4373
|
};
|
|
4363
4374
|
const filterUdp = mode === "webrtc/tcp";
|
|
4364
4375
|
function createPeerConnection() {
|
|
4365
|
-
const peerConnection = createBasePeerConnection(signal, onCandidate, filterUdp);
|
|
4376
|
+
const peerConnection = createBasePeerConnection(signal, onCandidate, filterUdp, iceServers);
|
|
4366
4377
|
peerConnection.onconnectionstatechange = () => {
|
|
4367
4378
|
if (signal.aborted) return;
|
|
4368
4379
|
const connectionState = peerConnection.connectionState;
|
|
@@ -4407,7 +4418,7 @@ function createWebRTCHandler(options) {
|
|
|
4407
4418
|
};
|
|
4408
4419
|
}
|
|
4409
4420
|
function createBackchannelHandler(options) {
|
|
4410
|
-
const { filterUdp, onConnected, onFailed, onCandidate, signal } = options;
|
|
4421
|
+
const { filterUdp, iceServers, onConnected, onFailed, onCandidate, signal } = options;
|
|
4411
4422
|
const state = {
|
|
4412
4423
|
pc: null,
|
|
4413
4424
|
micTransceiver: null,
|
|
@@ -4429,7 +4440,7 @@ function createBackchannelHandler(options) {
|
|
|
4429
4440
|
});
|
|
4430
4441
|
}
|
|
4431
4442
|
function createPeerConnection() {
|
|
4432
|
-
const peerConnection = createBasePeerConnection(signal, sendCandidate, filterUdp);
|
|
4443
|
+
const peerConnection = createBasePeerConnection(signal, sendCandidate, filterUdp, iceServers);
|
|
4433
4444
|
peerConnection.onconnectionstatechange = () => {
|
|
4434
4445
|
if (signal.aborted) return;
|
|
4435
4446
|
const connectionState = peerConnection.connectionState;
|
|
@@ -4525,6 +4536,7 @@ var StreamConnection = class {
|
|
|
4525
4536
|
triedSourceIds = /* @__PURE__ */ new Set();
|
|
4526
4537
|
options;
|
|
4527
4538
|
wsTransport;
|
|
4539
|
+
iceServers;
|
|
4528
4540
|
scope = effectScope(true);
|
|
4529
4541
|
stopsWhenHidden = suspendsWhenHidden();
|
|
4530
4542
|
connectionGeneration = 0;
|
|
@@ -4580,6 +4592,7 @@ var StreamConnection = class {
|
|
|
4580
4592
|
if (!ctx.wsTransport) throw new Error("[camera.ui] StreamConnection requires a wsTransport on CameraUiContext — pass `wsTransport` to createCameraUiPlugin.");
|
|
4581
4593
|
this.target = ctx.target;
|
|
4582
4594
|
this.wsTransport = ctx.wsTransport;
|
|
4595
|
+
this.iceServers = ctx.iceServers;
|
|
4583
4596
|
const { autoStart = true } = options;
|
|
4584
4597
|
this.status = ref("idle");
|
|
4585
4598
|
this.activeMode = ref("webrtc");
|
|
@@ -5383,6 +5396,7 @@ var StreamConnection = class {
|
|
|
5383
5396
|
this.startConnectTimeout();
|
|
5384
5397
|
const handler = createWebRTCHandler({
|
|
5385
5398
|
mode,
|
|
5399
|
+
iceServers: this.iceServers?.value,
|
|
5386
5400
|
signal: this.abortController.signal,
|
|
5387
5401
|
onConnected: (stream) => this.handleWebRTCConnected(stream),
|
|
5388
5402
|
onDisconnected: () => this.handleWebRTCDisconnected(),
|
|
@@ -5721,6 +5735,7 @@ var StreamConnection = class {
|
|
|
5721
5735
|
if (this.webrtcHandler && (!this.webrtcHandler.isConnected || this.awaitingWebRTCFrame)) return;
|
|
5722
5736
|
const handler = createBackchannelHandler({
|
|
5723
5737
|
filterUdp: this.requestedMode.value === "webrtc/tcp",
|
|
5738
|
+
iceServers: this.iceServers?.value,
|
|
5724
5739
|
signal: this.abortController.signal,
|
|
5725
5740
|
onCandidate: (candidate) => this.sendWsMessage({
|
|
5726
5741
|
type: "webrtc/candidate",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camera.ui/browser",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"description": "camera.ui browser client",
|
|
5
5
|
"author": "seydx (https://github.com/cameraui/clients)",
|
|
6
6
|
"type": "module",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@camera.ui/logger": "file:../../packages/logger",
|
|
41
41
|
"@camera.ui/rpc": "^1.1.2",
|
|
42
|
-
"@camera.ui/sdk": "~1.4.
|
|
42
|
+
"@camera.ui/sdk": "~1.4.6",
|
|
43
43
|
"@camera.ui/transport": "file:../../packages/transport",
|
|
44
44
|
"@eneris/push-receiver": "^4.4.0",
|
|
45
45
|
"@microsoft/api-extractor": "^7.60.1",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"eslint-plugin-vue": "^10.12.0",
|
|
58
58
|
"globals": "^17.14.0",
|
|
59
59
|
"prettier": "^3.9.10",
|
|
60
|
-
"rimraf": "^6.1.
|
|
60
|
+
"rimraf": "^6.1.4",
|
|
61
61
|
"typescript": "5.9.3",
|
|
62
62
|
"typescript-eslint": "^8.72.1",
|
|
63
63
|
"unplugin-dts": "^1.1.2",
|