@displayxr/inline3d 1.48.0 → 1.49.0

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/CHANGELOG.md CHANGED
@@ -5,6 +5,61 @@ entry points (`.`, `./three`) are frozen for 1.x, while the **scene subpaths** (
5
5
  `./splat`, `./model`) are a preview tier whose options may change in any release. Entries below say
6
6
  which tier they touch, because that is what tells you whether an upgrade can move your pixels.
7
7
 
8
+ ## 1.49.0 — 2026-11-03
9
+
10
+ ### Added — the content tile: share a running 3D app into a call (`./call`, `./camera`)
11
+
12
+ Preview tier. In the DisplayXR Browser a participant can share a running DisplayXR app, and every
13
+ other participant sees it in 3D on their own display (runtime ADR-061, "3D screen share"). What is
14
+ sent is the app's two views before weaving, side by side, on a **second video track** next to the
15
+ camera; each receiver weaves it for its own panel. See [`docs/call.md` § Sharing a 3D app](docs/call.md#sharing-a-3d-app).
16
+
17
+ - **Discovery** (`./call`): `listShareableApps()`, `watchShareableApps(cb)`, `isAppShareDevice()`,
18
+ `openAppShare(deviceId)`. The browser lists each app as a `videoinput` labelled
19
+ `DisplayXR: <app> (3D)` (id `dxr-app:…`); detection takes the label, the id prefix or the track's
20
+ `displayxrStereo.source === 'app'`, so browsers that do not expose the hint fields yet work, and a
21
+ missing `zeroDisparityShiftFrac` reads as 0. `openAppShare` is when the runtime asks the user on
22
+ the sender's machine; a Deny rejects with `code: 'share-denied'`.
23
+ - **Sharing**: `handle.shareContent(stream, descriptor)`, `handle.stopContent({ stopTrack })`,
24
+ `handle.content`; the `content` event (`{ id | 'self', on, appName }`); `CallPeer.content`;
25
+ `tile(id, 'content')` (`data-dxr-kind="content"`); `selfContentView` (`<dxr-call self-content-view>`)
26
+ for a woven preview of your own share.
27
+ - **Display-referred convergence**: the content message carries the disparity of the sender's
28
+ display plane (`convergence: { known: true, frac }`, 0 for every app today); a receiver applies
29
+ it directly, never measures the frames, and its depth slider still adds.
30
+ - **Wire**: `hello.content: true` (capability) and a `content` message, both additive (wire version
31
+ stays 1). The content transceiver is added only when both hellos say `content`, by the pair's
32
+ offerer with a same-generation re-offer, so an older participant never gets a second video
33
+ m-line (nor a second camera sender) — they keep seeing your camera, and you get
34
+ `warning { code: 'content-unsupported' }`. While content is on, the camera sends at 60% of its
35
+ bitrate; the content track gets the side-by-side budget and holds its resolution.
36
+ - `weave`, `speaking` and `display` events now carry `kind: 'camera' | 'content'`.
37
+ - **`./camera`: a running app is never a camera.** Its label says "3D", so `stereoLabelHint` would
38
+ have preferred it: no probe path of `openCamera` (and so `camera: 'auto'`) opens an app-share
39
+ device, `exclude: false` included, and `label:` searches skip them. They are in `skipped` with
40
+ `reason: 'app-share'` (`CameraSkip.reason`, new).
41
+
42
+ ### Fixed — the Ultraleap hand tracker is excluded by its bare brand name; the default camera is not opened blind (`./camera`, `./call`)
43
+
44
+ 1.48.0's built-in exclusion list is generic words (hand tracking, tracking camera, eye tracking,
45
+ depth camera). On Windows an Ultraleap (Leap 2 / Leap Motion Controller) enumerates as a UVC device
46
+ labelled just **"Ultraleap"**, with modes of 2:1 or squarer, so neither the list nor the pair shape
47
+ caught it; with its tracking service stopped it was free and, as the browser's *default* camera on
48
+ that box, became the call's self view (win box, 2026-11-04). The list now also names `ultraleap`,
49
+ `leap motion`, `infrared` and `ir camera`.
50
+
51
+ While an excluded device is listed and labels are visible, the default camera is no longer opened
52
+ blind and closed again: the first camera that is not excluded is opened by id, so a sensor is never
53
+ started (an eye tracker's camera must not be). With labels hidden the prime stays blind, as before.
54
+
55
+ ### Added — `prefer: 'label:<text>'` opens the first camera whose label contains the text (`./camera`, `./call`)
56
+
57
+ For a URL or a config, where a per-origin `deviceId` is useless: `openCamera({ prefer: 'label:hd webcam' })`,
58
+ `addCall(wall, el, { camera: 'label:brio' })`. Case-insensitive; with no permission yet the default
59
+ camera is primed once and let go so the labels become visible; no match rejects with `no-camera`.
60
+ Explicit like a `deviceId`, so it opens an excluded device too. The call sample passes
61
+ `?camera=label:…` (and a bare `?camera=<deviceId>`) straight through.
62
+
8
63
  ## 1.48.0 — 2026-11-03
9
64
 
10
65
  ### Changed — auto-convergence is measured on the sender's raw frames (`./call`)
package/call.d.ts CHANGED
@@ -273,6 +273,11 @@ export interface CallOptions {
273
273
  autoJoin?: boolean;
274
274
  /** The small self view (mirrored; a stereo self view is mirrored AND eye-swapped — an `addCameraView`). Default true. */
275
275
  selfView?: boolean;
276
+ /**
277
+ * While you share content (`shareContent`), also show it to yourself: a woven preview tile,
278
+ * `tile('self', 'content')`. Default false (you have the app itself on your display).
279
+ */
280
+ selfContentView?: boolean;
276
281
  /** Colours, radius, font, tile aspect and strings — see {@link CallTheme}. */
277
282
  theme?: CallTheme;
278
283
  /** Invite links: `base` (default this page's URL, query kept, fragment replaced); `updateUrl` writes `#room=` into the page URL on join (default: `ui === true`). */
@@ -329,8 +334,85 @@ export interface CallPeer {
329
334
  readonly speaking: boolean;
330
335
  /** Their display name (`name` option / `setName()`), sanitised; null when they sent none (or an older SDK). */
331
336
  readonly name: string | null;
337
+ /** What they share (3D app share): `on`, its format and the app's name (null while `on` is false). */
338
+ readonly content: { readonly on: boolean; readonly format: CallFormat | null; readonly appName: string | null };
339
+ }
340
+
341
+ /** Which of a participant's tiles: their camera (the person) or the content they share. */
342
+ export type CallTileKind = 'camera' | 'content';
343
+
344
+ /**
345
+ * The convergence of shared content. `known: true`: the frames are DISPLAY-REFERRED — `frac` is the
346
+ * disparity of the sender's display plane as a fraction of the per-eye width (`zeroDisparityShiftFrac`
347
+ * of a DisplayXR app, 0 in v1). Receivers apply it directly and never measure the frames; their
348
+ * depth control adds to it. `known: false`: shown as sent.
349
+ */
350
+ export interface ContentConvergence {
351
+ known: boolean;
352
+ frac: number | null;
353
+ }
354
+
355
+ /** What `shareContent` announces (also `openAppShare()`'s `descriptor`, which fits it as is). */
356
+ export interface ContentDescriptor {
357
+ format?: CallFormat;
358
+ width?: number;
359
+ height?: number;
360
+ convergence?: ContentConvergence;
361
+ appName?: string | null;
362
+ }
363
+
364
+ /** `handle.content`: what you share right now. */
365
+ export interface CallContent {
366
+ readonly on: true;
367
+ readonly format: CallFormat;
368
+ readonly width: number;
369
+ readonly height: number;
370
+ readonly appName: string | null;
371
+ readonly convergence: Readonly<ContentConvergence>;
372
+ }
373
+
374
+ /** A running DisplayXR app the browser offers to share (`listShareableApps`). */
375
+ export interface ShareableApp {
376
+ readonly deviceId: string;
377
+ /** `DisplayXR: <app> (3D)`. */
378
+ readonly label: string;
379
+ readonly appName: string | null;
380
+ }
381
+
382
+ /** An opened app share (`openAppShare`): pass `stream` (+ `descriptor`) to `shareContent`. The track is yours to stop. */
383
+ export interface AppShare {
384
+ stream: MediaStream;
385
+ track: MediaStreamTrack;
386
+ descriptor: { kind: 'content'; format: CallFormat; width: number; height: number; convergence: { known: true; frac: number }; appName: string | null };
332
387
  }
333
388
 
389
+ /** Why `openAppShare` rejected (`error.code`): the user said no at the runtime's prompt, it failed, or the device is not an app. */
390
+ export type AppShareErrorCode = 'share-denied' | 'share-failed' | 'not-app-share';
391
+
392
+ /**
393
+ * Is this a running DisplayXR app offered for 3D screen share (runtime ADR-061) rather than a
394
+ * camera? A `MediaDeviceInfo`, a label, a track, or its settings: true on the label
395
+ * `DisplayXR: <app> (3D)`, a `dxr-app:` device id, or `displayxrStereo.source === 'app'`. No camera
396
+ * probe (`camera: 'auto'`, `openCamera`) ever opens one.
397
+ */
398
+ export function isAppShareDevice(device: MediaDeviceInfo | MediaStreamTrack | MediaTrackSettings | { label?: string; deviceId?: string } | string | null | undefined): boolean;
399
+
400
+ /**
401
+ * The running apps this browser offers to share. Empty before the page holds camera permission
402
+ * (the browser lists none until then), on any other browser, or when none is shareable.
403
+ */
404
+ export function listShareableApps(opts?: { mediaDevices?: MediaDevices }): Promise<ShareableApp[]>;
405
+
406
+ /** `cb(apps)` now and whenever the list changes (`devicechange`). Returns the unsubscribe. */
407
+ export function watchShareableApps(cb: (apps: ShareableApp[]) => void, opts?: { mediaDevices?: MediaDevices }): () => void;
408
+
409
+ /**
410
+ * Open a shareable app as a side-by-side track (default 2560×720 at 30 fps). The runtime asks the
411
+ * user on THIS machine now; Deny rejects with `code: 'share-denied'`. The track ends when the app
412
+ * exits. Stop it yourself when you stop sharing.
413
+ */
414
+ export function openAppShare(deviceId: string, opts?: { width?: number; height?: number; frameRate?: number; mediaDevices?: MediaDevices }): Promise<AppShare>;
415
+
334
416
  /**
335
417
  * `error` codes — fatal for a feature, never for the widget. `'camera-busy'` (held by another
336
418
  * app: audio-only until `retryCamera()`), `'no-camera'`, `'permission-denied'`, `'unreachable'`
@@ -367,7 +449,7 @@ export type CallErrorCode =
367
449
  | (string & {});
368
450
 
369
451
  /** `warning` codes — degraded, not broken. */
370
- export type CallWarningCode = 'lift-not-bundled' | 'turn-shed' | (string & {});
452
+ export type CallWarningCode = 'lift-not-bundled' | 'turn-shed' | 'content-unsupported' | (string & {});
371
453
 
372
454
  export interface CallEvents {
373
455
  joined: { room: string; id: string };
@@ -376,8 +458,8 @@ export interface CallEvents {
376
458
  peer: { id: string };
377
459
  peerleft: { id: string; reason: string };
378
460
  state: { id: string; state: PeerState };
379
- /** How this side shows a participant changed (a hello arrived, lift went live, the wall came back). */
380
- display: { id: string; display: CallDisplay };
461
+ /** How this side shows a participant changed (a hello arrived, lift went live, the wall came back). `kind`: which of their tiles. */
462
+ display: { id: string; display: CallDisplay; kind: CallTileKind };
381
463
  speaker: { id: string | null };
382
464
  /**
383
465
  * Per peer (`id`) every 2 s; or, with `id: null` and `lift`, when lifted tiles on the web
@@ -393,6 +475,8 @@ export interface CallEvents {
393
475
  * `'turn-shed'`: only THIS session got no TURN from the hosted service (an anonymous session
394
476
  * while the monthly relay budget is nearly spent, or too many credential requests from this
395
477
  * address this hour); the call runs STUN-only. A publishable key keeps TURN.
478
+ * `'content-unsupported'`: you share content and a participant's SDK predates it (no `content` in
479
+ * their hello) — they keep seeing your camera only. Once per participant per share.
396
480
  */
397
481
  warning: { code: CallWarningCode; message: string };
398
482
  /** A participant's display name arrived or changed (`name: null` = they cleared it). */
@@ -412,9 +496,14 @@ export interface CallEvents {
412
496
  * (`rewoven()`). `id` is a participant's, or `'self'` for your self view. `'flat'`: the wall
413
497
  * says the tile will not weave (`reason`, e.g. `'layer-failed'`) — it is shown flat.
414
498
  */
415
- weave: { id: string; state: 'woven' | 'flat'; reason?: string; ms: number };
499
+ weave: { id: string; state: 'woven' | 'flat'; reason?: string; ms: number; kind: CallTileKind };
416
500
  /** A participant (or `'self'`) started / stopped speaking. */
417
- speaking: { id: string; on: boolean };
501
+ speaking: { id: string; on: boolean; kind: CallTileKind };
502
+ /**
503
+ * A participant (or `'self'`) started or stopped sharing content (3D app share). `reason` on your
504
+ * own stop: `'stopped'` (`stopContent()`), `'ended'` (the track ended — the app exited), `'left'`.
505
+ */
506
+ content: { id: string; on: boolean; appName: string | null; reason?: 'stopped' | 'ended' | 'left' };
418
507
  }
419
508
 
420
509
  export interface CallHandle {
@@ -456,7 +545,18 @@ export interface CallHandle {
456
545
  * A participant's tile element (for `layout: 'none'`), or null; `'self'` is your self view
457
546
  * (`data-dxr-peer="self"`). Style it in place; never move it.
458
547
  */
459
- tile(peerId: string): HTMLElement | null;
548
+ tile(peerId: string, kind?: CallTileKind): HTMLElement | null;
549
+ /**
550
+ * Share content on a second video track (3D app share): a running DisplayXR app's views from
551
+ * `openAppShare()` (pass its `descriptor` too), or any side-by-side track. Every participant on a
552
+ * DisplayXR SDK with content support gets a content tile; older ones keep seeing your camera only
553
+ * (`warning` `'content-unsupported'`). Replaces a previous share. Resolves with what is announced.
554
+ */
555
+ shareContent(src: MediaStream | MediaStreamTrack, opts?: ContentDescriptor): Promise<CallContent>;
556
+ /** Stop sharing. `stopTrack: true` also stops the track (ends the runtime's share). Resolves false when nothing was shared. */
557
+ stopContent(opts?: { stopTrack?: boolean }): Promise<boolean>;
558
+ /** What you share right now, or null. */
559
+ readonly content: CallContent | null;
460
560
  /** Your display name, or null. */
461
561
  readonly name: string | null;
462
562
  /** Change your display name (re-sent to everyone in `hello`). Returns it sanitised (null = none). */
@@ -511,7 +611,7 @@ export function parseInviteLink(link: string | { hash?: string; href?: string }
511
611
  // a bubbling, composed `CustomEvent` named `dxr-call:<event>` with the payload in `detail`, and
512
612
  // exposes the handle as `el.call`. Attributes (read once, at connect): `room`, `signaling` (a
513
613
  // URL), `key`, `camera`, `layout`, `accent`, `max-peers`, `no-ui`, `ui="tiles"`, `auto-join`,
514
- // `mono3d="off"`, `no-audio`, `no-self-view`, `no-auto-converge`, `no-send-convergence`,
614
+ // `mono3d="off"`, `no-audio`, `no-self-view`, `self-content-view`, `no-auto-converge`, `no-send-convergence`,
515
615
  // `tile-aspect`, `invite-base`, `browser-url`, `debug`. Everything else is `el.options`, set before connect; options win.
516
616
 
517
617
  export class DxrCallElement extends HTMLElement {
package/camera.d.ts CHANGED
@@ -21,8 +21,11 @@ export type CameraFormat = 'sbs' | 'mono';
21
21
  * Which camera to open. `'auto'` (default): a stereo device when one is present — the DisplayXR
22
22
  * Browser's "3D Camera" (recognised by its `displayxrStereo` track settings, never by its label),
23
23
  * or a device delivering wider than 2.5:1 frames — else the default webcam. `'stereo'` prefers
24
- * the pair and falls back to mono; `'mono'` never probes; a string is a `deviceId`; a
25
- * `MediaStream` is used as given, with {@link CameraOptions.format} declaring what it is.
24
+ * the pair and falls back to mono; `'mono'` never probes; a string is a `deviceId`, or
25
+ * `'label:<text>'` for the first camera whose label contains the text (case-insensitive; for a URL
26
+ * or a config, where a per-origin deviceId is useless); a `MediaStream` is used as given, with
27
+ * {@link CameraOptions.format} declaring what it is. A `deviceId` or `label:` is explicit and
28
+ * opens an {@link CameraOptions.exclude excluded} device too.
26
29
  */
27
30
  export type CameraPreference = 'auto' | 'stereo' | 'mono' | (string & {}) | MediaStream;
28
31
 
@@ -59,12 +62,15 @@ export interface CameraOptions {
59
62
  /**
60
63
  * Devices no probe may open. Built in, always (unless `false`): video inputs whose label marks a
61
64
  * sensor rather than a camera — hand tracking, an eye tracker's or a "tracking camera"'s stream,
62
- * a depth camera (`/\b(hand[- ]?track|tracking camera|eye[- ]?track|depth camera)/i`). Add your
63
- * own: a string matches a label (case-insensitive substring) or a deviceId exactly; a RegExp
64
- * tests the label. Applied on every probe path, the last-resort "try every device" one
65
- * included; a default camera that turns out to be excluded is closed again. Left-out devices
66
- * are listed in `skipped` with `excluded: true`. `false` turns the built-in list off. An explicit
67
- * `deviceId` (`prefer`) is your choice and is opened regardless.
65
+ * a depth camera, an infrared / IR camera, and the Ultraleap / Leap Motion hand tracker, which
66
+ * enumerates under its bare brand name
67
+ * (`/\b(hand[- ]?track|tracking camera|eye[- ]?track|depth camera|ultraleap|leap motion|infrared|ir camera)/i`).
68
+ * Add your own: a string matches a label (case-insensitive substring) or a deviceId exactly; a
69
+ * RegExp tests the label. Applied on every probe path, the last-resort "try every device" one
70
+ * included; while an excluded device is listed the default camera is not opened blind (the first
71
+ * other camera is opened by id), and a default that turns out to be excluded is closed again.
72
+ * Left-out devices are listed in `skipped` with `excluded: true`. `false` turns the built-in
73
+ * list off. An explicit `deviceId` or `label:` (`prefer`) is your choice and is opened regardless.
68
74
  */
69
75
  exclude?: ReadonlyArray<string | RegExp> | false;
70
76
  /** Verbose console logging. */
@@ -85,6 +91,8 @@ export interface CameraSkip {
85
91
  busy?: boolean;
86
92
  denied?: boolean;
87
93
  excluded?: boolean;
94
+ /** Why it was left out: `'excluded'` (a sensor, or your `exclude`), or `'app-share'` (a running DisplayXR app offered for 3D screen share — never a camera). */
95
+ reason?: 'excluded' | 'app-share';
88
96
  }
89
97
 
90
98
  export interface CameraEvents {