@viamrobotics/sdk 0.0.29 → 0.0.30
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/main.es.js +45 -23
- package/dist/main.umd.js +2 -2
- package/package.json +1 -1
package/dist/main.es.js
CHANGED
|
@@ -226624,23 +226624,26 @@ class RobotClient {
|
|
|
226624
226624
|
p
|
|
226625
226625
|
);
|
|
226626
226626
|
this.peerConn = i.peerConnection, this.transportFactory = i.transportFactory, i.peerConnection.ontrack = (s) => {
|
|
226627
|
-
events.emit("track", s);
|
|
226628
226627
|
const { kind: g } = s.track, l = s.streams[0];
|
|
226629
226628
|
if (!l)
|
|
226630
|
-
throw new Error("expected event stream to exist");
|
|
226631
|
-
const u = l.id,
|
|
226632
|
-
|
|
226633
|
-
|
|
226634
|
-
|
|
226635
|
-
|
|
226636
|
-
|
|
226629
|
+
throw events.emit("track", s), new Error("expected event stream to exist");
|
|
226630
|
+
const u = l.id.replaceAll("+", ":");
|
|
226631
|
+
Object.defineProperty(l, "id", {
|
|
226632
|
+
value: u
|
|
226633
|
+
}), events.emit("track", s);
|
|
226634
|
+
const c = l.id, m = document.querySelectorAll(
|
|
226635
|
+
`[data-stream="${c}"]`
|
|
226636
|
+
);
|
|
226637
|
+
for (const y of m) {
|
|
226638
|
+
const f = document.createElement(g);
|
|
226639
|
+
f.srcObject = l, f.autoplay = !0, f instanceof HTMLVideoElement ? (f.playsInline = !0, f.controls = !1) : f.controls = !0, y.querySelector(g)?.remove(), y.append(f);
|
|
226637
226640
|
}
|
|
226638
|
-
const
|
|
226639
|
-
`[data-stream-preview="${
|
|
226641
|
+
const h = document.querySelectorAll(
|
|
226642
|
+
`[data-stream-preview="${c}"]`
|
|
226640
226643
|
);
|
|
226641
|
-
for (const
|
|
226642
|
-
const
|
|
226643
|
-
|
|
226644
|
+
for (const y of h) {
|
|
226645
|
+
const f = document.createElement(g);
|
|
226646
|
+
f.srcObject = l, f.autoplay = !0, f instanceof HTMLVideoElement ? (f.playsInline = !0, f.controls = !1) : f.controls = !0, y.querySelector(g)?.remove(), y.append(f);
|
|
226644
226647
|
}
|
|
226645
226648
|
};
|
|
226646
226649
|
} else
|
|
@@ -451228,6 +451231,9 @@ StreamServiceClient.prototype.removeStream = function o(e, r, p) {
|
|
|
451228
451231
|
};
|
|
451229
451232
|
};
|
|
451230
451233
|
var StreamServiceClient_1 = StreamServiceClient;
|
|
451234
|
+
const getValidSDPTrackName = function(o) {
|
|
451235
|
+
return o.replaceAll(":", "+");
|
|
451236
|
+
};
|
|
451231
451237
|
class StreamClient extends EventDispatcher {
|
|
451232
451238
|
client;
|
|
451233
451239
|
options;
|
|
@@ -451238,18 +451244,34 @@ class StreamClient extends EventDispatcher {
|
|
|
451238
451244
|
return this.client;
|
|
451239
451245
|
}
|
|
451240
451246
|
async add(e) {
|
|
451241
|
-
const r = this.streamService, p = new stream_pb$1.AddStreamRequest();
|
|
451242
|
-
p.setName(
|
|
451243
|
-
|
|
451244
|
-
|
|
451245
|
-
|
|
451247
|
+
const r = this.streamService, p = new stream_pb$1.AddStreamRequest(), t = getValidSDPTrackName(e);
|
|
451248
|
+
p.setName(t), this.options.requestLogger?.(p);
|
|
451249
|
+
try {
|
|
451250
|
+
await promisify(
|
|
451251
|
+
r.addStream.bind(r),
|
|
451252
|
+
p
|
|
451253
|
+
);
|
|
451254
|
+
} catch {
|
|
451255
|
+
p.setName(e), this.options.requestLogger?.(p), await promisify(
|
|
451256
|
+
r.addStream.bind(r),
|
|
451257
|
+
p
|
|
451258
|
+
);
|
|
451259
|
+
}
|
|
451246
451260
|
}
|
|
451247
451261
|
async remove(e) {
|
|
451248
|
-
const r = this.streamService, p = new stream_pb$1.RemoveStreamRequest();
|
|
451249
|
-
p.setName(
|
|
451250
|
-
|
|
451251
|
-
|
|
451252
|
-
|
|
451262
|
+
const r = this.streamService, p = new stream_pb$1.RemoveStreamRequest(), t = getValidSDPTrackName(e);
|
|
451263
|
+
p.setName(t), this.options.requestLogger?.(p);
|
|
451264
|
+
try {
|
|
451265
|
+
await promisify(
|
|
451266
|
+
r.removeStream.bind(r),
|
|
451267
|
+
p
|
|
451268
|
+
);
|
|
451269
|
+
} catch {
|
|
451270
|
+
p.setName(e), this.options.requestLogger?.(p), await promisify(
|
|
451271
|
+
r.removeStream.bind(r),
|
|
451272
|
+
p
|
|
451273
|
+
);
|
|
451274
|
+
}
|
|
451253
451275
|
}
|
|
451254
451276
|
}
|
|
451255
451277
|
export {
|